We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question
0

[Libreoffice online] write text in document programatically

asked 2019-01-17 11:39:03 +0200

tdias gravatar image

updated 2020-07-11 21:29:02 +0200

Alex Kemp gravatar image

Hello, I'm using Libreoffice online and I want to add a menu that when is pressed write a string in the document.

I tried with JS and cannot find a solution because of the data rendering in images by Libreoffice online.

Anyone know if it's possible and how can I do that? Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-07-09 13:59:37 +0200

rodvsilva gravatar image

updated 2021-05-04 14:39:48 +0200

Hi, I did a lot of tests and find the solution. If you use a framed based solution, you can send this commands:

window.frames[0].postMessage(JSON.stringify({'MessageId': 'Host_PostmessageReady'}), '*');
window.frames[0].postMessage(JSON.stringify({'MessageId': 'CallPythonScript',
     'SendTime': Date.now(),
     'ScriptFile': 'InsertText.py',
     'Function': 'InsertText',
     'Values': {'text': {'type': 'string', 'value': '<<Text to insert>>'}}
     }),
'*');

Are you using frame?

More details you can find here: https://git.libreoffice.org/online/+/...

I have presented a webinar too, with plugins details: https://www.youtube.com/watch?v=wrxn_...

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-01-17 11:39:03 +0200

Seen: 77 times

Last updated: May 04