opensagres / xdocreport

XDocReport means XML Document reporting. It's Java API to merge XML document created with MS Office (docx) or OpenOffice (odt), LibreOffice (odt) with a Java model to generate report and convert it if you need to another format (PDF, XHTML...).
https://github.com/opensagres/xdocreport
1.22k stars 372 forks source link

Get tiff images working again in docx files #456

Open MichaelB340923 opened 3 years ago

MichaelB340923 commented 3 years ago

I have a software tool that uses XDocReport. I originally developed it with version 1.0.4 back in the 2016 time frame. It uses XDocReport for, among other things, to display dynamic images in .docx files. With version 1.0.4 it supports jpg, gif, bmp, png, and tiff formats. I recently tried upgrading to 2.0.2 and while jpg, gif, bmp and png formats still work ok with tiff I now get a recoverable document corruption error when I open it:

"Word found unreadable content in "".docx. Do you want to recover the contents of this document? If you trust the source of this document, click Yes."

When I click "Yes" Word can recover the document and the tiff image displays properly in the Word document. However, I can't give it to the users like this (who use tiff files all the time). For the time being I am going to have to add format conversion to my software to prevent this.

Ideally XDocReport should support all the image formats that Word does.

spyhunter99 commented 2 years ago

do you by chance have an example of the code for v1.0.4 that inserts the image?

Edit: found an example. maybe this will help you https://github.com/opensagres/xdocreport.samples/blob/master/samples/fr.opensagres.xdocreport.samples.docxandfreemarker/src/fr/opensagres/xdocreport/samples/docxandfreemarker/DocxProjectWithFreemarkerAndImageList.java