"ZLib decompress error" loading document that contains image(s)

Questions and answers on how to use DOCXReadWrite
Post Reply
Ash
Posts: 1
Joined: Mon Aug 21, 2023 7:29 am

"ZLib decompress error" loading document that contains image(s)

Post by Ash »

Hello!
I'm facing an issue with the DOCXReadWriteVcl component in Delphi2010.
Loading a docx file that contains an image and has been previously saved using TDOCXReadWriteVcl will result in a "ZLib decompress error".
Both the original and new document can be opened using MS Word and they look identical - however the new document is slightly smaller in size.

Code: Select all

original.LoadFromFile('original.docx'); //Contains image, 291KB size
original.SaveToFile('new.docx'); //Copy, 284KB size

new.LoadFromFile('new.docx'); //ZLib decompress error
Tested with JPEGs, PNGs and BMPs - same result each time.
If the document does not contain an image it works just fine and I am able to edit the text, insert page breaks, save and load multiple times, etc.

Is there any way to disable compression in the first place or fix the issue some other way?

Best regards,
Ash
Post Reply