https://issues.apache.org/bugzilla/show_bug.cgi?id=55476

            Bug ID: 55476
           Summary: After XWPFRun.addPicture() Word considers the document
                    as corrupted
           Product: POI
           Version: 3.10-dev
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XWPF
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 30758
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30758&action=edit
the 2-lines patch to XWPFRun which solves the problem of adding images to docx
document using XWPFDocument

If you try to add a picture to XWPFDocument:

XWPFDocument document = new
XWPFDocument().createParagraph().createRun().addPicture(pictureIn,
Document.PICTURE_TYPE_JPEG, "test.jpg", Units.toEMU(300), Units.toEMU(100));

and then will save it using:

document.write(outputStream);

Microsoft Word won't open such file saying that it is corrupted.
There is discussion which touches this issue as well in comments in:
https://issues.apache.org/bugzilla/show_bug.cgi?id=49765

In particular the root cause is mentioned here:
https://issues.apache.org/bugzilla/show_bug.cgi?id=49765#c14

I'm attaching the patch which resolves the issue.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to