2016-08-15 3 views
2

XLSファイルを+80.000でエクスポートしようとしていますが、 "net.sf.jasperreports.engine.JRException:セルを追加できません"というメッセージが表示されます。+80.000レコードでXLSをエクスポートする

"MAXIMUM_ROWS_PER_SHEET"を上げようとしましたが、機能しませんでした。

これは私のコードです:

ByteArrayOutputStream out = new ByteArrayOutputStream(); 
try { 
    JasperReport relatorioJasper = (JasperReport) JRLoader.loadObjectFromFile(parametros.get("REPORT_JASPER")+""); 

    JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(listaReport); 
    JasperPrint jasperPrint = JasperFillManager.fillReport(relatorioJasper, parametros, dataSource); 

    JRXlsExporter exporter = new JRXlsExporter(); 
    exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); 
    exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(out)); 
    SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration(); 
    configuration.setOnePagePerSheet(false); 
    configuration.setDetectCellType(true); 
    configuration.setCollapseRowSpan(false); 
    configuration.setRemoveEmptySpaceBetweenColumns(true); 
    // exporter.setParameter(JRXlsExporterParameter.MAXIMUM_ROWS_PER_SHEET, 10000); 

    exporter.setConfiguration(configuration); 
    exporter.exportReport(); 


    InputStream relatorios = new ByteArrayInputStream(out.toByteArray()); 
    return stream2file(relatorios, parametros.get("REPORT_NAME")+"" ,Constantes.XLS); 
}catch(Exception e){ 
    e.printStackTrace(); 
} 
return null; 

誰も私を助けることができますか?

+2

ポストスタックトレースを投稿できますか? –

+0

@ user3633580添付された* JasperReports *ライブラリのソースコードを使用してコードをデバッグしようとすることができます。 * JExcelApiExporter *クラスのように、新しいJRException(EXCEPTION_MESSAGE_KEY_CANNOT_ADD_CELL)が発生する場所にブレークポイントを設定することができます。この場合、サードパーティのライブラリ(POIまたはJExcelApi)の例外の理由をキャッチすることができます –

+0

ヒントXLSをXLSに変更するだけで動作しました。 – user3633580

答えて

1

輸出にトラブルがないと思います。 MAXIMUM_ROWS_PER_SHEETさんもお手伝いできません。
XLSは、65,536個を超える行を含むことはできません。 XLSXを使用してください。
this answer from Superuserを参照してください。

+0

これはさまざまなバージョンのpoiの制限です。https://poi.apache.org/apidocs/org/apache/poi/ss/SpreadsheetVersion.html –

+0

ありがとうございました! – user3633580

+0

あなたはようこそ!) – sanluck

関連する問題