0
私は6列のシートを持っていて、50k行に似ています。私は1つの行をn回コピーしたいと思います。 は今のところ、私はこのようにやっている:Apache POI公式でn行をコピーする
for (int i=0; i<=excel_max_row; i++) {
row = sheet3.createRow((short) i);
cell = row.createCell(0);
cell.setCellFormula("IFERROR(LOOKUP(Template!A"+(i+2)+",'Dropdown-Values'!A:A,'Dropdown-Values'!B:B),\"\")");
cell = row.createCell(1);
cell.setCellFormula("IF(Template!B"+(i+2)+"=0,\"\",Template!B"+(i+2)+")");
cell = row.createCell(2);
cell.setCellFormula("IFERROR(LOOKUP(Template!C"+(i+2)+",'Dropdown-Values'!C:C,'Dropdown-Values'!D:D),\"\")");
cell = row.createCell(3);
cell.setCellFormula("IFERROR(LOOKUP(Template!D"+(i+2)+",'Dropdown-Values'!E:E,'Dropdown-Values'!F:F),\"\")");
cell = row.createCell(4);
cell.setCellFormula("IFERROR(LOOKUP(Template!E"+(i+2)+",'Dropdown-Values'!E:E,'Dropdown-Values'!F:F),\"\")");
cell = row.createCell(5);
cell.setCellFormula("IF(Template!F"+(i+2)+"=0,\"\",Template!F"+(i+2)+")");
}
XSSFFormulaEvaluator.evaluateAllFormulaCells(wb);
それは動作しますが、excel_max_row
が50Kまでできるため、非常に遅いです。すべてのフォーラムでn回の行をすばやくコピーする方法はありますか?ユーザーがファイルを開いたときにたくさん
あなたのための '非常にslow'何ですか? – XtremeBaumer
私は 'evaluateAllFormulaCells'が減速の主な原因だと思っています。代替案の[計算式の再計算](https://poi.apache.org/spreadsheet/eval.html#Recalculation+of+Formulas)をお読みください。 –
221288ms 200行、はい問題は評価です – ayasha