Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Copy a table to clipboard
Copy a table to clipboard [message #446030] Tue, 16 November 2004 10:49 Go to next message
Henrik Skovgaard is currently offline Henrik SkovgaardFriend
Messages: 84
Registered: July 2009
Member
Hi

Has anyone made this before, or can someone give some hints where to look ?

I want to be able to copy selected rows in a table to Excel.

Thanks - Henrik
Re: Copy a table to clipboard [message #446033 is a reply to message #446030] Tue, 16 November 2004 13:33 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Excel understands Text format, RTF format and HTML format (in addition to
some other formats not supported by SWT).

For example:
Using TextTransfer "1\t2\t3\n4\t5\t6" will be pasted into Excel as two rows
of three cells each

Using HTMLTransfer
<html>
<body>
<table>
<tr><td>1</td><td>2</td><td>3</td></tr>
<tr><td>4</td><td>5</td><td>6</td></tr>
</table>
</body>
</html>


"Henrik Skovgaard" <hsk@reklamedata.dk.no.spam> wrote in message
news:cnclvp$f8t$1@www.eclipse.org...
> Hi
>
> Has anyone made this before, or can someone give some hints where to look
> ?
>
> I want to be able to copy selected rows in a table to Excel.
>
> Thanks - Henrik
>
Re: Copy a table to clipboard [message #446034 is a reply to message #446033] Tue, 16 November 2004 13:47 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Actually the HTMLTransfer seems to need a bit of header info, something like
this:

Version:1.0
StartHTML:0000000000
EndHTML:0000000000
StartFragment:0000000000
EndFragment:0000000000
<html><body>
<table>
<tr><td>A</td><td>B</td><td>C</td></tr>
<tr><td>D</td><td>E</td><td>F</td></tr>
</table>
</body></html>

"Veronika Irvine" <veronika_irvine@oti.com> wrote in message
news:cncvkg$28c$1@www.eclipse.org...
> Excel understands Text format, RTF format and HTML format (in addition to
> some other formats not supported by SWT).
>
> For example:
> Using TextTransfer "1\t2\t3\n4\t5\t6" will be pasted into Excel as two
> rows of three cells each
>
> Using HTMLTransfer
> <html>
> <body>
> <table>
> <tr><td>1</td><td>2</td><td>3</td></tr>
> <tr><td>4</td><td>5</td><td>6</td></tr>
> </table>
> </body>
> </html>
>
>
> "Henrik Skovgaard" <hsk@reklamedata.dk.no.spam> wrote in message
> news:cnclvp$f8t$1@www.eclipse.org...
>> Hi
>>
>> Has anyone made this before, or can someone give some hints where to look
>> ?
>>
>> I want to be able to copy selected rows in a table to Excel.
>>
>> Thanks - Henrik
>>
>
>
Re: Copy a table to clipboard [message #446057 is a reply to message #446033] Wed, 17 November 2004 11:49 Go to previous messageGo to next message
Henrik Skovgaard is currently offline Henrik SkovgaardFriend
Messages: 84
Registered: July 2009
Member
Thanks, but how do I enable the Ctrl+C key combination on a table so I can
do a clipboard.setContents() on the selected rows in the table?

I could make a menu option called Copy and use the setAccelerator - but I
also have other widgets with "build in" copy/paste functionality (Text
widget for example). Wouldn't the setAccelerator interfere with that?

Henrik


"Veronika Irvine" <veronika_irvine@oti.com> wrote in message
news:cncvkg$28c$1@www.eclipse.org...
> Excel understands Text format, RTF format and HTML format (in addition to
> some other formats not supported by SWT).
>
> For example:
> Using TextTransfer "1\t2\t3\n4\t5\t6" will be pasted into Excel as two
> rows of three cells each
Re: Copy a table to clipboard [message #446131 is a reply to message #446057] Wed, 17 November 2004 16:07 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
You need to create a menu and set the accelerator. Text has built in
support because it is clear what kind of data to set on the Clipboard
(Text). Table is not that simple.

"Henrik Skovgaard" <hsk@reklamedata.dk.no.spam> wrote in message
news:cnfdsf$u0t$1@www.eclipse.org...
> Thanks, but how do I enable the Ctrl+C key combination on a table so I can
> do a clipboard.setContents() on the selected rows in the table?
>
> I could make a menu option called Copy and use the setAccelerator - but I
> also have other widgets with "build in" copy/paste functionality (Text
> widget for example). Wouldn't the setAccelerator interfere with that?
>
> Henrik
>
>
> "Veronika Irvine" <veronika_irvine@oti.com> wrote in message
> news:cncvkg$28c$1@www.eclipse.org...
>> Excel understands Text format, RTF format and HTML format (in addition to
>> some other formats not supported by SWT).
>>
>> For example:
>> Using TextTransfer "1\t2\t3\n4\t5\t6" will be pasted into Excel as two
>> rows of three cells each
>
>
Previous Topic:About the underlying system
Next Topic:DirectoryFieldEditorQuestion
Goto Forum:
  


Current Time: Fri Apr 19 23:58:38 GMT 2024

Powered by FUDForum. Page generated in 0.03111 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top