共有式の最大行数を指定

可能な使用シナリオ

共有式のデフォルト最大行数は64ですが、任意の数に設定可能です(例:1000)。共有式の行数がこれを超える場合、複数の共有式に分割されます。これを制御するためにAspose.Cells for Python via .NETはWorkbook.settings.max_rows_of_shared_formulaプロパティを提供しています。

todo:image_alt_text

共有式の最大行数を指定

以下のサンプルコードは、 Workbook.settings.max_rows_of_shared_formula プロパティの使用方法について説明しています。それは共有式の最大行数を5に設定し、100行の共有式をセルD1に追加し、出力Excelファイルに保存します。出力Excelファイルの内容を抽出して sheet1.xml を確認すると、前述のスクリーンショットでハイライトされているように、共有式が5行ごとに分割されていることがわかります。

サンプルコード

from aspose.cells import Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
wb = Workbook()
# Set the max rows of shared formula to 5
wb.settings.max_rows_of_shared_formula = 5
# Access first worksheet
ws = wb.worksheets[0]
# Access cell D1
cell = ws.cells.get("D1")
# Set the shared formula in 100 rows
cell.set_shared_formula("=Sum(A1:A2)", 100, 1)
# Save the output Excel file
wb.save("outputSpecifyMaximumRowsOfSharedFormula.xlsx")