0

There is a previous post doing what I need in graphical mode here:

Convert Calc(Excel) Data in XML in OpenOffice

Is it possible to do exactly the same thing as above .ods (.xls) to .xml using this transformation sample from the command line?

/Paul

So far I created the XML Filter as described as "CustData" and ran this command (tried all three variations):

libreoffice --convert-to xml:CustData --outdir ut/ outfile.xlsx
libreoffice --convert-to xml:"CustData" --outdir ut/ outfile.xlsx
libreoffice --convert-to xml[:CustData] --outdir ut/ outfile.xlsx


convert /home/paul/outfile.xlsx -> /home/paul/ut//outfile.xml using filter : CustData
Error: Please verify input parameters... (SfxBaseModel::impl_store <file:///home/paul/ut//outfile.xml> failed: 0x81a)

What am I doing wrong here? And why will double slashes occur between "ut" and "outfile.xml"?

/Paul

Paul Bergström
  • 253
  • 1
  • 2
  • 14

1 Answers1

2

The error code failed: 0x81a means that the filter name is wrong.

The first two --convert-to xml:CustData and --convert-to xml:"CustData" are working for me if the filter is named "CustData" and the command line command is started from the same user who has created the filter in his Libreoffice following the steps in Creating XML Filters..

The last one --convert-to xml[:CustData] cannot work. This is a misinterpretation of the syntax pattern in Starting the LibreOffice Software With Parameters. There the brackets in --convert-to output_file_extension[:output_filter_name] means that the :output_filter_name is optional and not that the brackets should be used here.

The double slashes are there because you are setting a slash in --outdir ut/. Should be --outdir ut if current directory/ut is meant.

But the main problem probably is, that the user who runs your command line command is not the same who has created the filter. The filters are stored in the users home directory. My filter for example in /home/axel/.config/libreoffice/4/user/registrymodifications.xcu. So other users have no access to them.

Do following Distributing an XML filter as package. Save the XML Filter as a package from the one user and then install the XML Filter from that package when logged in as the other user.

No worry about the statement "The XML Filter Settings dialog is only available when a text document is open." This is not true. It is also available when a calc document is open.

Axel Richter
  • 56,077
  • 6
  • 60
  • 87
  • Thank you so much for your answer. It made me get pass that error - though as far as I can see - the user creating the XML Filter was actually the same that then used it from the command line. It was after doing the "save as a package" and "install from a package" when the error disappeared. However the XML-file doesn't look at all as I intended, but I guess that is another kind of problem. – Paul Bergström May 28 '18 at 07:23
  • @Paul Bergström: The only thing which changes when doing "install from a package" is the location of the `*.xsl` file of the filter. This is copied to `/home/axel/.config/libreoffice/4/user/xslt/` directory. So if it works after that then the problem was with accessing the originally path of the `*.xsl` file of the filter. – Axel Richter May 31 '18 at 07:25