Is it possible using a Xojo web app to create a Word (or for that matter Pages and/or pdf) document from information stored on a server, and then have that document downloaded to the user. So for example some material could be entered by the user using a form on the web app, and then when the “Download Doco” button is clicked there would be some basic formatting done in the background before downloading the document in .doc or .docx (or .pages or .pdf) format. Any pointers or sample code gratefully received. I have the full set of XojoMBS plugins if that provides additional options.
Thanks any advice.
If you have libreOffice / OpenOffice installed you can use the python script “unoconv” invoked from a RS/xojo shell
Command: unoconv -f pdf Document_to_convert
Not only that, you can also convert reports made by RS/Xojo to PDF automatically. Just make sure the RS/Xojo reports are saved in bmp format. Print output from RS/Xojo or reports is graphic so the pdf file will just represent an embedded image. Not very useful for text search in pdf document.
The unoconv can also convert word documents or openoffice/Libreoffice documents to pdf. And much more.
When you install libreoffice on windows make sure you also select the python part. you will also need to download unoconv from: GitHub - unoconv/unoconv: Universal Office Converter - Convert between any document format supported by LibreOffice/OpenOffice. And you have to use libreoffice’s own python.exe to execute unoconv as “pyuno.pyd” in delivered libreoffice is only supported for this version.
On Linux you just get all rpms for Libreoffice/ Openoffice. It is also supported for Mac.
More info about unoconv: http://dag.wieers.com/home-made/unoconv/
If you want to create documents from libreoffice:
Here is an example by using libreoffice to create a spreadsheet. But you can also export it to pdf. (Write an OpenOffice / LibreOffice Document with use of Xojo (Windows Platform Only) - Windows - Xojo Programming Forum)
If you want to use Microsoft windows see: http://documentation.xojo.com/index.php/OLEObject
This link might also be useful: http://great-white-software.com/rblibrary/index.php?main_page=index&manufacturers_id=34
There seems to be a bug in Xojo2013R3, using OLEObject: OLEobject - ReportManager - Web - Xojo Programming Forum
Thanks John very comprehensive and a nice set of options for different purposes. Much appreciated!
Depends on what it is you want to do but you can write an XML document that matches Words XML spec & then send that to the user & it will open as either
I wrote a set of classes that let you do this with Excel so it’s certainly possible - it’s just not trivial as Word has such a large amount of functionality.
The other option may be to write an RTF file which does what you need.