Snippets code from my daily experience

August 1, 2009

Table2Clipboard and clipboard application interoperability

Filed under: calc,clipboard,excel,extension,openoffice,table2clipboard,xul — dafi @ 10:35 am

calc_excel_t2cMany users asked to me to add to the extension Table2Clipboard (T2C for friends) the ability to preserve web links and maintain the styles during tables copy.

Preserving links and other HTML tags was a very easy task, I’ve written the code very quickly and both OpenOffice Calc and Microsoft Excel have handled correctly the pasted content.

When I started to support style preservation I discovered different and ugly results on the two popular office suites making harder to write cross platform XUL code.

Actually T2C pastes to clipboard inserting data in two different formats (flavors), unicode plain text and HTML format.
When users do “Paste Special” the HTML format is pasted and applications (Excel or Calc) render inside the data sheet.

Both Excel and Calc handle only the deprecated FONT tag and a subset of TABLE tag attributes and this represents a great limitation for style preservation from T2C.

If you try to paste from Microsoft Explorer to Microsoft Excel you discover everything is copied, the styles are totally preserved but if you paste from Explorer to OpenOffice Calc all style are lost!!!

Well, Explorer inserts to clipboard also RTF formatted text and Excel works very fine with the barely public RTF file format.

Clipboard application interoperability goes to hell, HTML is not fully supported by the “Paste Special” feature available on both suites, and as usual Microsoft uses semi proprietary data formats to exchange informations between applications.

I think at least OpenOffice should improve its “Paste” feature simply adding support for HTML style attribute.

T2C can preserve correctly styles only implementing platform specific code for OpenOffice and Microsoft Office and I really hate write specific platform.

I’m considering other alternatives but I see only the darkness of C++, OLE and core dump…

5 Comments

  1. Just writing to say that your T2C extension is one of the most useful things I have installed on my computer. Thanks!

    Comment by Bo — August 1, 2009 @ 3:42 pm

    • Thank you for using T2C, I try to improve it. I like users feedback🙂

      Comment by dafi — August 1, 2009 @ 3:45 pm

  2. Hello,

    I just wanted to say thank you for your extension, works like a charm.

    Bence

    Comment by Bence — August 17, 2009 @ 11:12 pm

  3. […] work as well as the one on Microsoft products. The “Paste Special” feature available on OpenOffice doesn’t recognize CSS styles but only deprecated tags like […]

    Pingback by Table2Clipboard 1.0 now preserves styles « Snippets code from my daily experience — September 14, 2009 @ 6:49 pm


RSS feed for comments on this post.

Blog at WordPress.com.

%d bloggers like this: