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

Error when multiple numbering levels reference the same paragraph style #25

Open
arnab2511 opened this issue Mar 30, 2021 · 4 comments
Open

Comments

@arnab2511
Copy link

Exception in thread "main" java.lang.IllegalStateException: Duplicate key org.zwobble.mammoth.internal.docx.Numbering$AbstractNumLevel@72bef795
at java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
at java.util.HashMap.merge(HashMap.java:1254)
at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1625)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270)
at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1625)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.zwobble.mammoth.internal.docx.Numbering.(Numbering.java:72)
at org.zwobble.mammoth.internal.docx.NumberingXml.readNumberingXmlElement(NumberingXml.java:16)
at org.zwobble.mammoth.internal.docx.DocumentReader.lambda$readNumbering$7(DocumentReader.java:217)
at java.util.Optional.map(Optional.java:215)
at org.zwobble.mammoth.internal.docx.DocumentReader.readNumbering(DocumentReader.java:217)
at org.zwobble.mammoth.internal.docx.DocumentReader.readDocument(DocumentReader.java:29)
at org.zwobble.mammoth.internal.InternalDocumentConverter.convertToHtml(InternalDocumentConverter.java:55)
at org.zwobble.mammoth.internal.InternalDocumentConverter.lambda$convertToHtml$2(InternalDocumentConverter.java:48)
at org.zwobble.mammoth.internal.InternalDocumentConverter.withDocxFile(InternalDocumentConverter.java:85)
at org.zwobble.mammoth.internal.InternalDocumentConverter.lambda$convertToHtml$3(InternalDocumentConverter.java:47)
at org.zwobble.mammoth.internal.util.PassThroughException.unwrap(PassThroughException.java:16)
at org.zwobble.mammoth.internal.InternalDocumentConverter.convertToHtml(InternalDocumentConverter.java:46)
at org.zwobble.mammoth.DocumentConverter.convertToHtml(DocumentConverter.java:84)
at com.poc.images.ExtractImages.convertDocs(ExtractImages.java:143)
at com.poc.images.ExtractImages.main(ExtractImages.java:50)

@arnab2511
Copy link
Author

Is there a way to resolve the error, Can you please give some inputs to resolve this.

@mwilliamson
Copy link
Owner

Could you provide a minimal example document that causes the error?

@arnab2511
Copy link
Author

SU_v1.docx
All other doc files are getting converted correctly. I am using a Java project. with the mammoth version of 1.4.2

@mwilliamson
Copy link
Owner

Hmm, it looks like two w:lvl elements in numbering.xml have the same w:pStyle element. Specifically, they're in the same w:abstractNum but have different levels, so it's not entirely clear how to reconcile that with the spec (17.9.23 in ECMA-376, 4th Edition):

When a paragraph style is defined to include a numbering definition, any numbering level defined by the numPr element (§17.3.1.19) shall be ignored, and instead this element shall specify the numbering level associated with that paragraph style.

@mwilliamson mwilliamson changed the title While I try to convert a docx file to HTML I am getting this error. Error when multiple numbering levels reference the same paragraph style Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants