共有式の最大行数を指定

可能な使用シナリオ

共有数式のデフォルトの最大行数は64です。これは1000などの任意の数値にできます。共有数式のパフォーマンスは、行数の異なる数で変化します。そのため、Aspose.Cellsは共有数式の最大行数を指定するのに使用できる [0] プロパティを提供しています。共有数式は、共有数式の総行数がそれよりも大きい場合、次のスクリーンショットに示されているように、複数の共有数式に分割されます。

todo:image_alt_text

共有式の最大行数を指定

以下のサンプルコードは、出力Excelファイルに100行の共有数式をセルD1に追加し、共有数式の最大行数を5に設定して保存する方法を説明しています。出力Excelファイルの内容を抽出して、sheet1.xmlをチェックすると、上記のスクリーンショットでハイライトされた部分の後に共有数式が分割されているのが見えます。

サンプルコード

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
//Create workbook
Workbook wb = new Workbook();
//Set the max rows of shared formula to 5
wb.getSettings().setMaxRowsOfSharedFormula(5);
//Access first worksheet
Worksheet ws = wb.getWorksheets().get(0);
//Access cell D1
Cell cell = ws.getCells().get("D1");
//Set the shared formula in 100 rows
cell.setSharedFormula("=Sum(A1:A2)", 100, 1);
//Save the output Excel file
wb.save("outputSpecifyMaximumRowsOfSharedFormula.xlsx");