Forum > Windows
LibreOffice events listener
marcov:
Could you also add a small project to see how you test? I can at least test it on development versions of FPC.
chris_laz:
OK, here's a very simple test project, supplied as a zip. It should compile as-is in Lazarus, all required units are included (I think), plus a sample CSV file.
A form with one button and a memo.
Click the button to open a CSV file in Calc.
Start editing the CSV, and Calc's OnModified events should be logged in the memo - but nothing happens here, so obviously my plumbing is wrong.
I have Lazarus 3.6, FPC 3.2.2
Curt Carpenter:
--- Quote from: chris_laz on October 07, 2024, 11:10:26 am ---I am not sure where my original Delphi implementation came from (back in 2011), I must have found some hints online, as I am pretty sure I did not work this all out for myself.
--- End quote ---
I've been wrestling with some old code issues for the past two weeks too -- wonderfully frustrating isn't it? So many things have changed in the past thirteen years (across so many different interfaces in your case -- mine is much simpler :)).
chris_laz:
Just a thread bump, does anyone have any experience automating LibreOffice with Lazarus to share?
Thanks
rvk:
I'm not familiar with OO and LO automation via TLB... but when diving into this...
I see you used XEventListener.
If I look at the documentation of XEventListener I see it is deprecated:
https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1document_1_1XEventListener.html
XDocumentEventListener would be the new one:
https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1document_1_1XDocumentEventListener.html
It also states it uses XDocumentEventBroadcaster to be notified:
https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1document_1_1XDocumentEventBroadcaster.html
And XDocumentEventBroadcaster has a addDocumentEventListener, removeDocumentEventListener and notifyDocumentEvent.
Shouldn't those be used???
And more... you are now using the COM style code to create a LibreOffice document, but are using the TLB style code to interact with it. I'm not sure if you can mix those.
Navigation
[0] Message Index
[#] Next page
[*] Previous page