Apache POI is not supporting MS Word 2013(Strict Open XML Document) - .docx

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

Apache POI is not supporting MS Word 2013(Strict Open XML Document) - .docx

rathnamm
Hi Team,

If I save a MS Word document as "Strict Open XML Document(*.docx) then I am not able to process this document. I am getting below exception when I pass this document in XWPFDocument(InsputStream) code.

"java.lang.NullPointerException: while trying to invoke the method org.apache.poi.openxml4j.opc.PackageRelationship.getRelationshipType() of an object loaded from local variable 'partRel'               java.lang.NullPointerException: while trying to invoke the method org.apache.poi.openxml4j.opc.PackageRelationship.getRelationshipType() of an object loaded from local variable 'partRel'| at org.apache.poi.openxml4j.opc.OPCPackage.getPart(OPCPackage.java:586)| at org.apache.poi.POIXMLDocumentPart.<init>(POIXMLDocumentPart.java:91)| at org.apache.poi.POIXMLDocument.<init>(POIXMLDocument.java:56)| at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:120)"

Kindly let us know whether POI is going to support this format in future or will not support this format at all.

Thanks and Regards,
Rathna.
Reply | Threaded
Open this post in threaded view
|

Re: Apache POI is not supporting MS Word 2013(Strict Open XML Document) - .docx

Nick Burch-2
On Thu, 9 Jul 2015, rathnamm wrote:
> If I save a MS Word document as "Strict Open XML Document(*.docx) then I
> am not able to process this document. I am getting below exception when
> I pass this document in XWPFDocument(InsputStream) code.

What version of Apache POI are you trying this with? And if it isn't the
most recent, what happens when you upgrade?

Nick

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

Reply | Threaded
Open this post in threaded view
|

Re: Apache POI is not supporting MS Word 2013(Strict Open XML Document) - .docx

rathnamm
I am using Apache POI 3.8 but I tried with Apache POI 3.10 as well but it is not working.

Relationship target for Strict Open XMLDocument(*.docx) is
-<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Target="webSettings.xml" Type="http://purl.oclc.org/ooxml/officeDocument/relationships/webSettings" Id="rId3"/><Relationship Target="settings.xml" Type="http://purl.oclc.org/ooxml/officeDocument/relationships/settings" Id="rId2"/><Relationship Target="styles.xml" Type="http://purl.oclc.org/ooxml/officeDocument/relationships/styles" Id="rId1"/><Relationship Target="theme/theme1.xml" Type="http://purl.oclc.org/ooxml/officeDocument/relationships/theme" Id="rId5"/><Relationship Target="fontTable.xml" Type="http://purl.oclc.org/ooxml/officeDocument/relationships/fontTable" Id="rId4"/></Relationships>

But for normal Word Document(.docx)

-<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Target="webSettings.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" Id="rId3"/><Relationship Target="settings.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Id="rId2"/><Relationship Target="styles.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Id="rId1"/><Relationship Target="theme/theme1.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Id="rId5"/><Relationship Target="fontTable.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Id="rId4"/></Relationships>.

Apache POI code is always expecting

PackageRelationship coreRel = pkg.getRelationshipsByType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument").getRelationship(0);

Normal .docx format relationship.

Thanks and Regards,
Rathna.
Reply | Threaded
Open this post in threaded view
|

Re: Apache POI is not supporting MS Word 2013(Strict Open XML Document) - .docx

Nick Burch-2
On Thu, 9 Jul 2015, rathnamm wrote:
> I am using Apache POI 3.8 but I tried with Apache POI 3.10 as well but
> it is not working.

And what happens if you try the current latest release? (Those are both
old releases)

Nick

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

Reply | Threaded
Open this post in threaded view
|

Re: Apache POI is not supporting MS Word 2013(Strict Open XML Document) - .docx

kiwiwings
Some time ago I've created an uncommited patch for the 3rd transitional schema [1],
but this probably covers only content, not package structure.
I.e. afaik the transitional schema should also cover the strict schema,
but actually I need to test it ...

As I don't have any 2013 office products avaible,
please upload a test file to a new bug entry (or #56205).

Andi.


[1] https://bz.apache.org/bugzilla/show_bug.cgi?id=56205
Reply | Threaded
Open this post in threaded view
|

Re: Apache POI is not supporting MS Word 2013(Strict Open XML Document) - .docx

rathnamm
Hi Andi,

I have MS Word 2013 sample document with me. Could you please let me know where to attach it.

Thanks and Regards,
Rathna.