- Code: Select all
Exception in thread "main" java.lang.RuntimeException: internal error
at org.docx4j.org.xhtmlrenderer.render.Box.initContainingLayer(Box.java:472)
at org.docx4j.org.xhtmlrenderer.newtable.TableBox.layoutRunningHeader(TableBox.java:326)
at org.docx4j.org.xhtmlrenderer.newtable.TableBox.layoutChildren(TableBox.java:304)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:818)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:735)
at org.docx4j.org.xhtmlrenderer.newtable.TableBox.layoutTable(TableBox.java:282)
at org.docx4j.org.xhtmlrenderer.newtable.TableBox.layout(TableBox.java:242)
at org.docx4j.org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:61)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:947)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:818)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:735)
at org.docx4j.org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:61)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:947)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:818)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:735)
at org.docx4j.org.xhtmlrenderer.layout.BlockBoxing.layoutContent(BlockBoxing.java:61)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layoutChildren(BlockBox.java:947)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:818)
at org.docx4j.org.xhtmlrenderer.render.BlockBox.layout(BlockBox.java:735)
at org.docx4j.org.xhtmlrenderer.docx.DocxRenderer.layout(DocxRenderer.java:187)
at org.docx4j.convert.in.xhtml.XHTMLImporter.convert(XHTMLImporter.java:214)
at com.tinyreports.tinyrenderer.Test.main(Test.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
execution class:
- Code: Select all
public class Test {
public static void main(String[] args) throws Docx4JException, JAXBException {
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
XHTMLImporter.setHyperlinkStyle("Hyperlink");
NumberingDefinitionsPart ndp = new NumberingDefinitionsPart();
wordMLPackage.getMainDocumentPart().addTargetPart(ndp);
ndp.unmarshalDefaultNumbering();
System.out.println(
XmlUtils.marshaltoString(wordMLPackage.getMainDocumentPart().getJaxbElement(), true, true));
wordMLPackage.getMainDocumentPart().getContent().addAll(
XHTMLImporter.convert(new File("d:/convert.html"), null, wordMLPackage) );
wordMLPackage.save(new File("d:/html_output.docx") );
}
}