首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >XDocReport : XDocConverterException:找不到转换器from=DOCX

XDocReport : XDocConverterException:找不到转换器from=DOCX
EN

Stack Overflow用户
提问于 2016-04-21 09:55:52
回答 1查看 2.5K关注 0票数 3

我正在测试来自XDocReport的示例代码。我结合起来,创建了一个基于docx模板的docx和pdf报告。不管怎么说,我总是收到这样的信息

代码语言:javascript
复制
Apr 21, 2016 5:39:10 PM fr.opensagres.xdocreport.converter.ConverterRegistry internalFindConverter
SEVERE: Cannot find converters from=DOCX
fr.opensagres.xdocreport.converter.XDocConverterException: Cannot find converters from=DOCX
    at fr.opensagres.xdocreport.converter.ConverterRegistry.internalFindConverter(ConverterRegistry.java:121)
    at fr.opensagres.xdocreport.converter.ConverterRegistry.findConverter(ConverterRegistry.java:74)
    at fr.opensagres.xdocreport.document.AbstractXDocReport.getConverter(AbstractXDocReport.java:667)
    at fr.opensagres.xdocreport.document.AbstractXDocReport.convert(AbstractXDocReport.java:690)
    at fr.opensagres.xdocreport.samples.docxandfreemarker.DocxProjectWithFreemarkerList.main(DocxProjectWithFreemarkerList.java:231)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)

下面是代码:

代码语言:javascript
复制
try
        {
            InputStream in = DocxProjectWithFreemarker.class.getResourceAsStream( "DocxProjectWithFreemarkerList.docx" );
            IXDocReport report = XDocReportRegistry.getRegistry().loadReport( in, TemplateEngineKind.Freemarker );

            FieldsMetadata metadata = report.createFieldsMetadata();

            metadata.load( "developers", Developer.class, true );

            IContext context = report.createContext();
            Project project = new Project( "XDocReport" );
            context.put( "project", project );

            List<Developer> developers = new ArrayList<Developer>();
            developers.add( new Developer( "ZERR", "Angelo", "angelo.zerr@gmail.com" ) );
            developers.add( new Developer( "Leclercq", "Pascal", "pascal.leclercq@gmail.com" ) );

            context.put( "developers", developers );

            OutputStream out = new FileOutputStream( new File( "DocxProjectWithFreemarkerList_Out.docx" ) );
            report.process( context, out );

//            ===========================================================================================

            Options options = Options.getTo(ConverterTypeTo.PDF);

            OutputStream outt = new FileOutputStream(new File("DocxProjectWithFreemarkerList_Out.pdf"));
            report.convert(context, options, outt);

        }
        catch ( IOException e )
        {
            e.printStackTrace();
        }
        catch ( XDocReportException e )
        {
            e.printStackTrace();
        }

密码有什么问题吗?我怎样才能纠正这个错误?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-04-22 08:08:20

您的问题与本期相同。

您需要在类路径中拥有fr.opensagres.xdocreport.converter.docx.xwpf JAR和她的依赖关系JAR (iText等)。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36766046

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档