[Bug 61467] New: Created word file using apache poi api is corrupted after adding the image to word doc.

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 61467] New: Created word file using apache poi api is corrupted after adding the image to word doc.

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61467

            Bug ID: 61467
           Summary: Created word file using apache poi api is corrupted
                    after adding the image to word doc.
           Product: POI
           Version: 3.16-FINAL
          Hardware: PC
            Status: NEW
          Severity: major
          Priority: P2
         Component: XWPF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

Hi,

I have used apache poi 3.16 to create word document. whenever I add .tif images
to word document using run.addPicture(..) provided by poi 3.16 api. When
generated .doc or .docx is trying to open it throws below error message.

Error popup message - "XX.doc cannot be opened because there are problems with
the contents."

Looks like word file is corrupted.

Can you please take a look and help me about this issue.

Also please let me know if you need any additional information.

Thanks in advance !

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61467] Created word file using apache poi api is corrupted after adding the image to word doc.

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61467

[hidden email] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email]
                 OS|                            |All

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61467] Created word file using apache poi api is corrupted after adding the image to word doc.

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61467

Dominik Stadler <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #1 from Dominik Stadler <[hidden email]> ---
Can you provide some self-sufficient sample-code which allows to reproduce the
problem?

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61467] Created word file using apache poi api is corrupted after adding the image to word doc.

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61467

--- Comment #2 from [hidden email] ---
xWPFParagraph title = doc.createParagraph();    
        XWPFRun run = title.createRun();
        run.setText("Fig.1 A Natural Scene");
        run.setBold(true);
        title.setAlignment(ParagraphAlignment.CENTER);

        String imgFile = "C:\\WordGenerator\\Congisoft_Logo.png";
                    FileInputStream is = new FileInputStream(imgFile);
                    run.addBreak();
                    run.addPicture(is, XWPFDocument.PICTURE_TYPE_JPEG, imgFile,
Units.toEMU(200), Units.toEMU(200)); // 200x200 pixels
                    is.close();

        FileOutputStream fos = new FileOutputStream("F:\\test4.docx");
        doc.write(fos);
        fos.flush();
        fos.close();  


///
Whole i am trying to open my word document.
Error popup message - ".doc cannot be opened because there are problems with
the contents."

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61467] Created word file using apache poi api is corrupted after adding the image to word doc.

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61467

--- Comment #3 from Mark Murphy <[hidden email]> ---
(In reply to chandanam1412 from comment #2)

> xWPFParagraph title = doc.createParagraph();    
>         XWPFRun run = title.createRun();
>         run.setText("Fig.1 A Natural Scene");
>         run.setBold(true);
>         title.setAlignment(ParagraphAlignment.CENTER);
>
>         String imgFile = "C:\\WordGenerator\\Congisoft_Logo.png";
>            FileInputStream is = new FileInputStream(imgFile);
>            run.addBreak();
>            run.addPicture(is, XWPFDocument.PICTURE_TYPE_JPEG, imgFile,
> Units.toEMU(200), Units.toEMU(200)); // 200x200 pixels
>            is.close();
>
>         FileOutputStream fos = new FileOutputStream("F:\\test4.docx");
>         doc.write(fos);
>         fos.flush();
>         fos.close();  
>
>
> ///
> Whole i am trying to open my word document.
> Error popup message - ".doc cannot be opened because there are problems with
> the contents."

So you are wondering why adding a PNG, but telling POI that it is a JPEG
produces a corrupted document?

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]