[Solved] Load corrupted Writer document without confirmation

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
_savage
Posts: 194
Joined: Sun Apr 21, 2013 12:55 am

[Solved] Load corrupted Writer document without confirmation

Post by _savage »

Hi, when I load a document in Writer I get this message:
oo.jpg
oo.jpg (54.32 KiB) Viewed 2897 times
I can click “Yes” and proceed loading, although some text of the loaded document is somewhat scrambled. Word loads the document equally scrambled but without complaints.

I’d like to proceed programmatically when I call loadComponentFromURL, but can’t find the option. I tried RepairPackage but that didn’t work, and loadComponentFromURL() raises an exception.

How would I go about this?

Thank you!
Jens

 Edit: Changed subject, was [Solved] How to proceed loading a suspected corrupted Writer document? 
Make your post understandable by others 
-- MrProgrammer, forum moderator 
Last edited by MrProgrammer on Fri Aug 02, 2024 8:45 pm, edited 3 times in total.
Reason: Add "confirmation" to topic subject
Mac 13.6 using LO 7.5.0.3, Ubuntu Linux using LO 24.2.2 headless.
FJCC
Moderator
Posts: 9432
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: How to proceed loading a suspected corrupted Writer document?

Post by FJCC »

It seems you are trying to load a damaged .docx file with LibreOffice. Is that correct? What is your overall goal? Do you only need to load this file or are you writing code for a general application?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
_savage
Posts: 194
Joined: Sun Apr 21, 2013 12:55 am

Re: How to proceed loading a suspected corrupted Writer document?

Post by _savage »

FJCC wrote: Fri Jul 26, 2024 1:43 am It seems you are trying to load a damaged .docx file with LibreOffice. Is that correct?
Well, “damaged” can be argued about because Word loads the file ok. And after clicking “Yes” to proceed the file loads.
FJCC wrote: Fri Jul 26, 2024 1:43 am What is your overall goal? Do you only need to load this file or are you writing code for a general application?
This is in the context of code running a headless Writer instance, so I’d like this to proceed loading the file — just as if I had clicked “Yes”.
Mac 13.6 using LO 7.5.0.3, Ubuntu Linux using LO 24.2.2 headless.
User avatar
Hagar Delest
Moderator
Posts: 32818
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: How to proceed loading a suspected corrupted Writer document?

Post by Hagar Delest »

See if that helps: query about SAXexception, especially this one maybe: [Solved] Avoid SAXException dialog with OLE pywin32.

Please add [Solved] at the beginning of the title in your first post (top of the topic) with the 🖉 button if your issue has been fixed.
LibreOffice 24.8 on Xubuntu 24.10 and 7.6.4.1 portable on Windows 10
_savage
Posts: 194
Joined: Sun Apr 21, 2013 12:55 am

Re: How to proceed loading a suspected corrupted Writer document?

Post by _savage »

That’s an interesting link, thank you! But turns out that the issue happens on LO 7.5 but not on 24.2 so I upgraded the relevant Docker images 8-)
Mac 13.6 using LO 7.5.0.3, Ubuntu Linux using LO 24.2.2 headless.
Post Reply