I have a corrupt Calc 7.5 spreadsheet on Linux (Read Error. / Format error discovered in the file in sub-document content.xml at 2,75207912(row,col)., 4.2 MiB, 262,045 cells). Ideally I would like a tool that that recovers a whole lot of my document, but I suspect that is not possible, so I am asking about recovering the macros. Since content.xml unpacks to 76,183,848 bytes, it sounds as though the error is almost at the end of a 72 MiB file, perhaps making it rather hard to correct.
I was able to open the document as an archive (with Ark), and extract the files. It seems that there the BASIC macros are probably not corrupted, and I would like to import them into a somewhat older backup of the document. The macros are in the same library (Standard) and the same modules in both documents.
The extracted files are, however, in XML, and if I try to import them I end up with XML in my macro document. I would, of course, work on copies of the documents.
I can think of these approaches:
- Use an existing tool to import them directly from XML.
- This sounds ideal, but seems impossible.
- Use an existing tool to convert them to BASIC text, and import those into the IDE, replacing the entire contents of each current module.
- This sounds like the most reliable plausible approach, if there is such a tool.
- Convert them to BASIC myself and then Import them: It seems one has to remove a little fairly redundant XML packaging and search-replace a limited number of XML constants, e.g.
'→'.-
This sounds fairly doable, perhaps with a
sedscript, but I am a little concerned they may be some gotchas.
-
This sounds fairly doable, perhaps with a
- Extract the backup document as well, replace the macros directory (
Basic/Standard) with the newer version, and pack everything into a new archive.-
This also sounds doable, and may offer other opportunities to recover more, but I do not know what format to pack it in. I could perhaps find out by asking
Ark; I see if say compression method =Deflateand it shows MDS, SHA-1 and SHA-256 hashes.
-
This also sounds doable, and may offer other opportunities to recover more, but I do not know what format to pack it in. I could perhaps find out by asking
- Use
Ark(or another archive manager) to replace the files in the archive.- I am not sure whether this works, but it sounds perhaps a little better than the previous.
What is most likely to succeed, of these or any other approach?