Class OdfPivotTableBuilder
- Namespace
- OdfKit.Spreadsheet
- Assembly
- OdfKit.dll
Builds ODF pivot tables, also known as data pilot tables. 用於建構 ODF 樞紐分析表(Data Pilot Table)的產生器。
public class OdfPivotTableBuilder
- Inheritance
-
OdfPivotTableBuilder
- Inherited Members
Remarks
Initializes a new instance of the OdfPivotTableBuilder class. 初始化 OdfPivotTableBuilder 類別的新執行個體。
Constructors
OdfPivotTableBuilder(string, OdfCellRange, OdfCellAddress, OdfTableSheet)
Builds ODF pivot tables, also known as data pilot tables. 用於建構 ODF 樞紐分析表(Data Pilot Table)的產生器。
public OdfPivotTableBuilder(string name, OdfCellRange sourceRange, OdfCellAddress targetStart, OdfTableSheet sheet)
Parameters
namestringThe pivot table name. / 樞紐分析表的名稱。
sourceRangeOdfCellRangeThe source data range. / 來源資料範圍。
targetStartOdfCellAddressThe target position start. / 目標位置起點。
sheetOdfTableSheetThe owning worksheet. / 所屬的工作表。
Remarks
Initializes a new instance of the OdfPivotTableBuilder class. 初始化 OdfPivotTableBuilder 類別的新執行個體。
Methods
AddCalculatedField(string, string)
Adds a calculated field using a formula to the pivot table. 新增計算欄位(使用公式)至樞紐分析表。
public OdfPivotTableBuilder AddCalculatedField(string fieldName, string formula)
Parameters
fieldNamestringThe calculated field name. / 計算欄位名稱。
formulastringThe ODF formula, such as
of:[.Sales]/[.Count]. / ODF 公式,例如of:[.Sales]/[.Count]。
Returns
- OdfPivotTableBuilder
The current instance for chaining. / 目前執行個體,以支援鏈結呼叫。
AddColumnField(string)
Adds a column field to the pivot table. 新增資料欄欄位至樞紐分析表。
public OdfPivotTableBuilder AddColumnField(string fieldName)
Parameters
fieldNamestringThe field name. / 欄位名稱。
Returns
- OdfPivotTableBuilder
The current instance for chaining. / 目前執行個體,以支援鏈結呼叫。
AddDataField(string)
Adds a data value field and its calculation function to the pivot table. 新增資料值欄位與對應的計算函式至樞紐分析表。
public OdfPivotTableBuilder AddDataField(string fieldName)
Parameters
fieldNamestring
Returns
- OdfPivotTableBuilder
The current instance for chaining. / 目前執行個體,以支援鏈結呼叫。
AddDataField(string, OdfPivotFunction)
Full overload of AddDataField that accepts fieldName and function. AddDataField 完整多載:接受 fieldName 與 function。
public OdfPivotTableBuilder AddDataField(string fieldName, OdfPivotFunction function)
Parameters
fieldNamestringfunctionOdfPivotFunction
Returns
AddDataField(string, string)
Adds a data value field using a raw function name string for legacy API compatibility. 新增資料值欄位,使用原始函式名稱字串(相容舊版 API)。
public OdfPivotTableBuilder AddDataField(string fieldName, string function)
Parameters
fieldNamestringThe field name. / 欄位名稱。
functionstringThe ODF function name string, such as
sumorcount. / ODF 函式名稱字串,例如sum、count。
Returns
- OdfPivotTableBuilder
The current instance for chaining. / 目前執行個體,以支援鏈結呼叫。
AddFilter(string, OdfPivotFilterOperator, string)
Adds a field filter condition to the pivot table. 新增欄位篩選條件至樞紐分析表。
public OdfPivotTableBuilder AddFilter(string fieldName, OdfPivotFilterOperator op, string value)
Parameters
fieldNamestringThe filter field name. / 篩選欄位名稱。
opOdfPivotFilterOperatorThe comparison operator. / 比較運算子。
valuestringThe filter value string. / 篩選值字串。
Returns
- OdfPivotTableBuilder
The current instance for chaining. / 目前執行個體,以支援鏈結呼叫。
AddPageField(string)
Adds a page or filter field to the pivot table. 新增頁面/篩選欄位至樞紐分析表。
public OdfPivotTableBuilder AddPageField(string fieldName)
Parameters
fieldNamestringThe field name. / 欄位名稱。
Returns
- OdfPivotTableBuilder
The current instance for chaining. / 目前執行個體,以支援鏈結呼叫。
AddRowField(string)
Adds a row field to the pivot table. 新增資料列欄位至樞紐分析表。
public OdfPivotTableBuilder AddRowField(string fieldName)
Parameters
fieldNamestringThe field name. / 欄位名稱。
Returns
- OdfPivotTableBuilder
The current instance for chaining. / 目前執行個體,以支援鏈結呼叫。
AddSortInfo(string)
Short overload of AddSortInfo that accepts fieldName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 fieldName;其餘可選參數使用預設值並轉呼叫最長 AddSortInfo 多載。
public OdfPivotTableBuilder AddSortInfo(string fieldName)
Parameters
fieldNamestring
Returns
AddSortInfo(string, bool)
Sets the sort direction for the specified field. 為指定欄位設定排序方向。
public OdfPivotTableBuilder AddSortInfo(string fieldName, bool ascending)
Parameters
fieldNamestringThe sort field name. / 排序欄位名稱。
ascendingboolWhether sorting is ascending; the default is true. / 是否升冪排序,預設為 true。
Returns
- OdfPivotTableBuilder
The current instance for chaining. / 目前執行個體,以支援鏈結呼叫。
Build()
Builds and applies the pivot table to the worksheet. 建置並將樞紐分析表套用至工作表中。
public OdfNode Build()
Returns
- OdfNode
The XML node that represents the built pivot table. / 代表建置後之樞紐分析表的 XML 節點。
WithColumnHeaders()
Short overload of WithColumnHeaders that uses default values for all optional parameters and forwards to the full overload. 便利多載:WithColumnHeaders 的所有可選參數使用預設值並轉呼叫最長多載。
public OdfPivotTableBuilder WithColumnHeaders()
Returns
WithColumnHeaders(bool)
Keeps source column header intent for fluent API compatibility without emitting nonstandard attributes. 保留來源欄標題意圖以相容 Fluent API,但不輸出非標準屬性。
public OdfPivotTableBuilder WithColumnHeaders(bool hasHeaders)
Parameters
hasHeadersbool
Returns
WithRowHeaders()
Short overload of WithRowHeaders that uses default values for all optional parameters and forwards to the full overload. 便利多載:WithRowHeaders 的所有可選參數使用預設值並轉呼叫最長多載。
public OdfPivotTableBuilder WithRowHeaders()
Returns
WithRowHeaders(bool)
Keeps source row header intent for fluent API compatibility without emitting nonstandard attributes. 保留來源列標題意圖以相容 Fluent API,但不輸出非標準屬性。
public OdfPivotTableBuilder WithRowHeaders(bool hasHeaders)
Parameters
hasHeadersbool