Create clipboard in OpenOffice/LibreOffice format

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
grrr1234
Posts: 2
Joined: Wed May 22, 2024 6:34 pm

Create clipboard in OpenOffice/LibreOffice format

Post by grrr1234 »

Hi, is there any documentation about how to write to the clipboard (or read from it) using the OpenOffice / LibreOffice specific formats?

I think those formats would be:
  • application/x-openoffice-embed-source-xml;windows_formatname="Star Embed Source (XML)"
  • application/x-openoffice-objectdescriptor-xml;windows_formatname="Star Object Descriptor (XML)";classname="8BC6B165-B1B2-4EDD-aa47-dae2ee689dd6";typename="LibreOffice 6.4 Text Document";viewaspect="1";width="16999";height="2995";posx="0";posy="0"
  • application/x-libreoffice-internal-id-4458
I would like to generate and insert elements that are unique to OpenOffice, so plaintext or RTF or HTML won't work.

Thanks for an answer!
LibreOffice 6.4.7.2, Ubuntu Linux
JeJe
Volunteer
Posts: 2920
Joined: Wed Mar 09, 2016 2:40 pm

Re: How to set the clipboard for OpenOffice / LibreOffice format

Post by JeJe »

There's copy and paste using the macro recorder for code. If you're copying several formats are put on the clipboard, which will include the native one. And if you're pasting I presume the native format will be chosen if available. So I don't see the need to do anything special for either?

Some info here though:

viewtopic.php?t=93562

https://www.openoffice.org/api/docs/com ... board.html
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
grrr1234
Posts: 2
Joined: Wed May 22, 2024 6:34 pm

Re: How to set the clipboard for OpenOffice / LibreOffice format

Post by grrr1234 »

Sorry, I meant setting the clipboard from an external application, where the OpenOffice API isn't available. Like a Java, JavaScript or Python app. I'd have this external app running over its own data, it'd write to the clipboard using the OpenOffice format, and I could then do a paste command inside the OpenOffice app and have the data there in a perfect layout.
LibreOffice 6.4.7.2, Ubuntu Linux
JeJe
Volunteer
Posts: 2920
Joined: Wed Mar 09, 2016 2:40 pm

Re: How to set the clipboard for OpenOffice / LibreOffice format

Post by JeJe »

I don't know how to do that and can only guess that it might need reinventing a very complicated wheel.

This sounds like it might be an xy problem. If you say a bit more about what you're trying to do you might get suggestions for a better solution. Open a hidden LO document and format it through automation perhaps?
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Mountaineer
Posts: 334
Joined: Sun Sep 06, 2020 8:27 am

Re: How to set the clipboard for OpenOffice / LibreOffice format

Post by Mountaineer »

grrr1234 wrote: Wed May 22, 2024 8:25 pm ... from an external application, where the OpenOffice API isn't available. Like a Java, JavaScript or Python app. ...
You are aware, it is possible to communicate with Open/LibreOffice via a port/socket, if AOO/LO is started with --accept. You can then use the api via XSCRIPTCONTEXT
LibreOffice 7.6 on Windows 10pro and other Versions parallel
Post Reply