Ask Your Question

using libreoffice api can i open an html document and save as PDF?

asked 2019-02-08 10:12:15 +0100

mysacramento gravatar image

I will use solely libreoffice API in C# code, can I open an html document and save as or export as PDF? Can I also export it as XSLX and CSV? thank you

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-02-08 12:19:43 +0100

Lupp gravatar image

updated 2019-02-08 15:20:09 +0100

What you want to do requires some understanding of so-called filters for the import and the export of documents. Having studied that you can use a sequence like

importDoc = StarDesktop.loadComponentFromURL(theURL, theFrameIdentifier, 0, importArgsArray)
importDoc.storeToURL(theNewURL, exportArgsArray)

If the way LibO presents the imported hypertext document is as you expected, the exported pdf document may also meet your needs.

===Edit1 2019-02-08 15:07 (UTC + 1)===
I found the time to go back to a related task I worked on about 2 years ago.
I reworked it (vers slightly) and added a demo Sub. The code is now contained in a demo.odt also containing explanations. Everything needed to run the demo with an example is wrapped ino this attached zip-archive (original name: I had to append a fake extension (.odt) to be able to upload. Restore the original name after download. Expand the archive into one empty folder and open demo.odt. You need to check the macros for malign code and -after negative result- to permit macros to run the demo.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-02-08 10:12:15 +0100

Seen: 31 times

Last updated: Feb 08