Page 1 of 1

Create clipboard in OpenOffice/LibreOffice format

Posted: Wed May 22, 2024 6:46 pm
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!

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

Posted: Wed May 22, 2024 7:02 pm
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

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

Posted: Wed May 22, 2024 8:25 pm
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.

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

Posted: Wed May 22, 2024 10:18 pm
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?

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

Posted: Sat May 25, 2024 9:04 am
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