I am trying to insert a Word document (docx) into a LibreOffice document using Ingasoftplus’s EasyOpenOffice and Writer. There is no direct ‘InsertDocument’ command an so I need to use the SetParam() and ExecuteDispatch() statments. So far I have:
I am trying to get it to work with a text file before moving on to Word docs. The code is either ignored or I get a ‘Read Error. Error reading file’ from LibreOffice. File permissions have been checked and adjusted.
Can you open the file as a user using libreoffice? Can you open the file from a different location? If using network shares try local and vice versa.
Some apps can sometimes be denied permission to access folders and other apps called can inherit the parent permission if shellexecuteex is being used to open libreoffice. You can also get a 2nd command line using libreoffice, like getting a 2nd dialtone in phone phreaking, so I wonder if LibreOffice might have had some updates recently which has locked this down but now also causing other problems.
Hi,
Yes I can open the file via LibreOffice. I originally started with a ‘docx’ file and that opens perfectly. I recorded a macro in Libreoffice and picked off code from there. I am frankly, out of my depth on this one!
EasyOpenOffice works with LibreOffice as well. I can’t see a way to call a stored macro directly but it may be possible via the 'ExecuteDispatch() statement.
If I run ONLY:
EW.ExecuteDispatch(‘.uno:InsertDoc’)
The I get an open file dialog and inserting the document works. Therefore the problem is in the ‘setup’ code statements where you can prime certain values. That is where I must be getting something wrong. I have tried different file locations and opened up the permissions to avoid that but no luck yet. I have the feeling I am missing something quite simple and then it would work!
Mark
I cant read their docs on their website so I cant really comment further. If you thinks its a problem open the doc file and you dont know which method to populate, fire up the debugger and see what is being passed when it calls libreoffice. You might be right about it being a working directory issue, so if you know the filename is being opened properly, just copy the doc to the folders you suspect it might be looking in and put the folder location in the doc so you know what folder is being opened.
I might have had that addon from them in the past, I know I had one of their com addons but this was c6 days, so I cant really chip in any further. Sorry.