Force repair on a file from CLI

Creating a macro - Writing a Script - Using the API

Force repair on a file from CLI

Postby pakt » Fri Dec 21, 2018 3:03 am


I'm not sure if I'm in the right place for this question, so apologies if I'm not. I'm working on an old bunch of code that's been handed off to me. The code generates an odt file (from a template) that is then converted to a pdf.
It does this with a call to:

python pyodconverter/ infile.odt outfile.pdf

However, for reasons currently unknown, this occasionally fails on certain generated odt files. When I attempt to open the offending odt file it says it's corrupt and needs to be repaired. When I repair it I can view it and it looks fine.

As a quick and dirty fix, I would like to force a repair from the CLI on any odt file that fails conversion. Is there a way to do this?

Unfortunately they're currently limited to using openoffice3.4 and upgrading is not an option at the moment.

Thanks for any guidance with this,

openoffice 3.4
Posts: 1
Joined: Fri Dec 21, 2018 2:53 am

Re: Force repair on a file from CLI

Postby RoryOF » Fri Dec 21, 2018 10:58 am

Does it give any error message when it announces the file is corrupt?

If the message is about a SaxParse error, the file needs repair by careful inspection of its internals.

If the message is merely that the file is corrupt, try opening it with an archiver (winzip, perhaps). In that case it may be possible to repair it from command line using archive repair techniques (check details for the archiver you use), although best to do this on a copy of the file.
Apache OpenOffice 4.1.7 on Xubuntu 18.04.4 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
Posts: 31239
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 7 guests