Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading Docs With DesignType,throw POIXMLException Error #1392

Closed
1 of 5 tasks
cloudrflight opened this issue Jul 23, 2024 · 2 comments
Closed
1 of 5 tasks

Reading Docs With DesignType,throw POIXMLException Error #1392

cloudrflight opened this issue Jul 23, 2024 · 2 comments

Comments

@cloudrflight
Copy link

cloudrflight commented Jul 23, 2024

NPOI Version

2.7.1

File Type

  • XLSX
  • XLS
  • DOCX
  • XLSM
  • OTHER

Upload the Docx File

word.docx

Please attach your original Excel File to help us reproduce the issue

Reproduce Steps

C# .net framework 4.7.2,using new XWPFDocument(stream)

Issue Description

                using (var rs = File.Open(path,FileMode.Open))
                {
                    var pk = PackageHelper.Open(rs);
                    using (var doc = new XWPFDocument(pk))
                    {
                    }
               }

throw error
image

@tonyqus tonyqus added the docx label Sep 5, 2024
@tonyqus tonyqus added file_error file format generation/writing issue and removed file_error file format generation/writing issue labels Sep 22, 2024
@tonyqus
Copy link
Member

tonyqus commented Sep 22, 2024

In document.xml.rels, there is a glossaryDocument relationship, which is not recognizable by NPOI. How is this file generated? Using third-party component or Microsoft Word?

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
	<Relationship Id="rId8" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" Target="endnotes.xml"/>
	<Relationship Id="rId13" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header3.xml"/>
	<Relationship Id="rId18" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument" Target="glossary/document.xml"/>
	<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" Target="numbering.xml"/>
	<Relationship Id="rId7" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" Target="footnotes.xml"/>
	<Relationship Id="rId12" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Target="footer2.xml"/>
	<Relationship Id="rId17" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/>
	<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml" Target="../customXml/item2.xml"/>
	<Relationship Id="rId16" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Target="footer4.xml"/>
	<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml" Target="../customXml/item1.xml"/>
	<Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" Target="webSettings.xml"/>
	<Relationship Id="rId11" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Target="footer1.xml"/>
	<Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/>
	<Relationship Id="rId15" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header4.xml"/>
	<Relationship Id="rId10" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header2.xml"/>
	<Relationship Id="rId19" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/>
	<Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
	<Relationship Id="rId9" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Target="header1.xml"/>
	<Relationship Id="rId14" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Target="footer3.xml"/>
</Relationships>

@tonyqus
Copy link
Member

tonyqus commented Sep 22, 2024

This is confirmed as a bug. XWPFFootnote.GetParent may get glossaryDocument as parent POIXMLDocumentPart. Instead, it should eventually get the document (XWPFDocument) as parent.

@tonyqus tonyqus added this to the NPOI 2.7.2 milestone Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants