java docx4j导出HTML为word(.docx)报错:org.docx4j.org.xhtmlrenderer.load INFO:: SAX XMLReader in use (parse

来源:互联网 发布:c语言二级文件系统 编辑:程序博客网 时间:2024/06/17 07:07
org.docx4j.org.xhtmlrenderer.load INFO:: SAX XMLReader in use (parser): org.apache.xerces.parsers.SAXParserorg.docx4j.org.xhtmlrenderer.load INFO:: SAX XMLReader in use (parser): org.apache.xerces.parsers.SAXParserorg.docx4j.org.xhtmlrenderer.load INFO:: SAX XMLReader in use (parser): org.apache.xerces.parsers.SAXParserorg.docx4j.org.xhtmlrenderer.load INFO:: SAX XMLReader in use (parser): org.apache.xerces.parsers.SAXParserorg.docx4j.org.xhtmlrenderer.load INFO:: SAX XMLReader in use (parser): org.apache.xerces.parsers.SAXParserorg.docx4j.org.xhtmlrenderer.load INFO:: SAX XMLReader in use (parser): org.apache.xerces.parsers.SAXParserorg.docx4j.org.xhtmlrenderer.load INFO:: White spaces are required between publicId and systemId.org.docx4j.org.xhtmlrenderer.exception WARNING:: Unhandled exception. Can't load the XML resource (using TRaX transformer). org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 63; White spaces are required between publicId and systemId.

小白刚刚学习用docx4j,不明白报错说的SAX使用XmlReader(分析器)和无法加载XML资源(使用Trax变压器)


publicId and systemId又是什么?说需要空间?求大家帮忙解决一下


用的别人的代码,下面是部分代码
protected WordprocessingMLPackage xhtml2word(Document doc) throws Exception {        WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage(PageSizePaper.valueOf("A4"), true); //A4纸,//横版:true        //configSimSunFont(wordMLPackage); //配置中文字体        XHTMLImporterImpl xhtmlImporter = new XHTMLImporterImpl(wordMLPackage);        wordMLPackage.getMainDocumentPart().getContent().addAll(//导入 xhtmlxhtmlImporter.convert(doc.html(), doc.baseUri())); //调试到这里报错,查看XHTMLImporterImpl  API没发现有什么缺少的包        return wordMLPackage;    }


                                             
0 0
原创粉丝点击