Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 365984

Summary: Not able to paste Ms-Excel column into SWT’s Text widget
Product: [Eclipse Project] Platform Reporter: Kumar <rajendrakumar>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, grant_gayed
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Kumar CLA 2011-12-08 01:35:59 EST
Build Identifier: I20100608-0911

I have  SWT  Text widget which is created with SWT.SINGLE  style 
e.g.  Text  myTextControl  = new Text(shell, SWT.SINGLE);

Now, when I try to copy column from Ms-Excel only first of that selected column gets pasted into Text widget and not entire column.
I do understand that  when I create  Text widget with SWT.MULTI  then I am able to paste entire Ms-Excel   column into widget but it will not be in  single row.

Previously, I was using  Swings JTextField and in that case whenever I used to paste MS-Excel column  ( using CTRL-V ) the entire Ms-Excel column gets pasted as a row in JTextField.  I am looking for same kind of feature for SWT  Text widget.  


Reproducible: Always

Steps to Reproduce:
1.Create SWT Text widget
2.Copy any column from Ms-Excel 
3. Paste into SWT Text widget.
Comment 1 Curtis Windatt CLA 2011-12-08 14:41:41 EST
To me the current behaviour makes sense.  If you are pasting multiple lines into a single line text box, you should only get the first line.  However, I will let SWT decide this bug's fate.
Comment 2 Grant Gayed CLA 2011-12-09 15:09:04 EST
This is the correct native win32 behaviour, the same thing happens if you paste into any other single-line win32 text control in Windows itself.  Closing report.

To override this native behaviour you need to access the clipboard content and insert the text you want into the text control.  For an example of accessing the clipboard see http://git.eclipse.org/c/platform/eclipse.platform.swt.git/plain/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet94.java .