Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/372.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在java中附加excel文件并使用JRXlsExporter编写该文件_Java_Excel_Jasper Reports - Fatal编程技术网

如何在java中附加excel文件并使用JRXlsExporter编写该文件

如何在java中附加excel文件并使用JRXlsExporter编写该文件,java,excel,jasper-reports,Java,Excel,Jasper Reports,我有一个excel文件,我想在该文件末尾添加新数据。 为此,我使用这种方法 public static void exportXLS(JasperPrint jasperPrint, String fileName) throws IOException, JRException{ SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration(); configurati

我有一个excel文件,我想在该文件末尾添加新数据。
为此,我使用这种方法

public static void exportXLS(JasperPrint jasperPrint, String fileName) throws IOException, JRException{
        SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
        configuration.setOnePagePerSheet(true);
        configuration.setDetectCellType(true);
        configuration.setCollapseRowSpan(false);
        configuration.setWhitePageBackground(false);

        File file = new File(fileName+".xls");
        FileOutputStream fos = new FileOutputStream(file,true);

        JRXlsExporter exporterXLS = new JRXlsExporter();
        exporterXLS.setExporterInput(new SimpleExporterInput(jasperPrint));
        exporterXLS.setExporterOutput(new SimpleOutputStreamExporterOutput(fos)); 
        exporterXLS.setConfiguration(configuration);
        exporterXLS.exportReport();
    }
我已将FileOutputStream构造函数的append参数设置为true,但仍然不起作用。
当我打开文件时,我只找到新数据,而不是旧数据