I have to add internal hyperlink (a reference to a bookmark) to a document but I don't know how to do.
I try to change the HyperlinkTest Sample, removing the instruction
- Code: Select all
rel.setTargetMode("External");
But I had an exception: org.docx4j.openpackaging.exceptions.Docx4JException: Failed to add parts from relationships
I also tried to load a document which contains "internal hyperlink" with the OpenAndTraverseDocument Sample and I had the following exception:
- Code: Select all
java.lang.NullPointerException
at org.docx4j.openpackaging.io.LoadFromZipNG.getInputStreamFromZippedPart(LoadFromZipNG.java:305)
at org.docx4j.openpackaging.io.LoadFromZipNG.getRawPart(LoadFromZipNG.java:508)
at org.docx4j.openpackaging.io.LoadFromZipNG.getPart(LoadFromZipNG.java:422)
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:351)
at org.docx4j.openpackaging.io.LoadFromZipNG.getPart(LoadFromZipNG.java:444)
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:351)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:236)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:189)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:188)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:169)
at test.OpenMainDocumentAndTraverse.main(OpenMainDocumentAndTraverse.java:58)
Exception in thread "main" org.docx4j.openpackaging.exceptions.Docx4JException: Failed to add parts from relationships
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:353)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:236)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:189)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:188)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:169)
at test.OpenMainDocumentAndTraverse.main(OpenMainDocumentAndTraverse2.java:58)
Caused by: org.docx4j.openpackaging.exceptions.Docx4JException: Failed to add parts from relationships
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:353)
at org.docx4j.openpackaging.io.LoadFromZipNG.getPart(LoadFromZipNG.java:444)
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:351)
... 5 more
Caused by: org.docx4j.openpackaging.exceptions.Docx4JException: Failed to getPart
at org.docx4j.openpackaging.io.LoadFromZipNG.getRawPart(LoadFromZipNG.java:642)
at org.docx4j.openpackaging.io.LoadFromZipNG.getPart(LoadFromZipNG.java:422)
at org.docx4j.openpackaging.io.LoadFromZipNG.addPartsFromRelationships(LoadFromZipNG.java:351)
... 7 more
Caused by: java.lang.NullPointerException
at org.docx4j.openpackaging.io.LoadFromZipNG.getInputStreamFromZippedPart(LoadFromZipNG.java:305)
at org.docx4j.openpackaging.io.LoadFromZipNG.getRawPart(LoadFromZipNG.java:508)
... 9 more
Is it a bug or a feature not supported?