0

我正在使用VaadinJasperReports开发我的第一个应用程序。我有以下麻烦,我必须提取以这种方式组成的 .rtf 文档:

第一个页面必须具有垂直方向,而第二个页面必须具有水平方向

现在我试图以这种方式解决这个问题:

    JasperCompileManager.compileReportToFile(pathFirstJrxml ,pathFirstJasper );  
    JasperCompileManager.compileReportToFile(pathSecondJrxml ,pathSecondJasper ); 

    File fileFirstReport = new File(pathFirstJasper);
    File fileSecondReport = new File(pathSecondJasper);

    JasperPrint jasperPrint = JasperFillManager.fillReport((JasperReport)JRLoader.loadObject(fileFirstReport),null,dataSourceFirstReport);
    JasperPrint jasperPrintSubReport = JasperFillManager.fillReport((JasperReport)JRLoader.loadObject(fileSecondReport),null,dataSourceSecondReport);

    List list = new ArrayList(); 
    list.add(jasperPrint);
    list.add( jasperPrintSubReport );

    JRRtfExporter rtfExporter = new JRRtfExporter();
    rtfExporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST, list);
    rtfExporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,pathOutputFile);
    System.out.println("Exporting report...");   
    rtfExporter.exportReport();
    System.out.println("Done!");

我创建了两个 jrxml 文件,第一个具有垂直方向,第二个具有水平方向,但这不起作用。输出文件具有水平方向。

我哪里错了?

4

1 回答 1

0

我将导出器从 rtfExporter 更改为 docxExporter,现在一切正常

于 2013-09-23T10:15:59.657 回答