1
我正在測試來自XDocReport的示例代碼。我結合在一起,創建了基於docx模板的docx和pdf報告。但是我一直在收到此消息XDocReport:XDocConverterException:找不到= DOCX的轉換器
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)
下面的代碼:
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", "[email protected]"));
developers.add(new Developer("Leclercq", "Pascal", "[email protected]"));
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();
}
這有什麼錯的代碼?我怎樣才能解決這個錯誤?
我不知道該產品,但'無法找到= DOCX轉換器似乎表明某些模塊可能會丟失? –