线程" main"中的例外情况java.lang.NoSuchMethodError:com.lowagie.text.pdf.PdfPCell.getRowspan()I

时间:2017-03-29 04:25:00

标签: java velocity

从DOCX生成PDF并创建动态表并在" PdfConverter.getInstance()"

中生成此错误时出现问题
    InputStream in =new FileInputStream(new File("C:\\XDocReports\\sample-In.docx"));
    IXDocReport report = XDocReportRegistry.getRegistry().loadReport(in, TemplateEngineKind.Velocity);

    FieldsMetadata metadata = report.createFieldsMetadata();

    metadata.load("details", Detail.class, true );

    IContext context = report.createContext();

    Project project = null;
    project = new Project("XDocReport-3","Hello Belong Mobile 1");
    context.put("project", project);

    List<Detail> details = new ArrayList<Detail>();
    for(int x=0;x<5;x++)
    {
        details.add(new Detail("ABC "+x, "XYZ", "ABC.XYZ@gmail.com"));
    }
    context.put("details", details);


    OutputStream out = new FileOutputStream(new File("C:\\XDocReports\\sample-Out.docx"));
    report.process(context, out);

    InputStream pdf = new FileInputStream(new File("C:\\XDocReports\\sample-In-1.docx"));
    XWPFDocument document = new XWPFDocument(pdf);
    PdfOptions options = null;//PdfOptions.create();
    OutputStream out2 = new FileOutputStream(new File("C:\\XDocReports\\sample-Out-1.pdf"));
    PdfConverter.getInstance().convert(document, out2, options);

0 个答案:

没有答案