Class OdfSheetBuilder
- Namespace
- OdfKit.Spreadsheet
- Assembly
- OdfKit.dll
Builds worksheet content with a fluent API. 提供工作表內容的 Fluent 建立 API。
public sealed class OdfSheetBuilder
- Inheritance
-
OdfSheetBuilder
- Inherited Members
Methods
AddChart(OdfCellAddress, OdfChartDefinition)
Adds an embedded chart to the current worksheet. 在目前工作表新增嵌入圖表。
public OdfSheetBuilder AddChart(OdfCellAddress anchor, OdfChartDefinition chart)
Parameters
anchorOdfCellAddressThe cell address. / 圖表左上角錨定儲存格
chartOdfChartDefinitionThe value to use. / 圖表定義
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddChart(string, OdfChartDefinition)
Adds an embedded chart to the current worksheet. 在目前工作表新增嵌入圖表。
public OdfSheetBuilder AddChart(string anchor, OdfChartDefinition chart)
Parameters
anchorstringThe cell address. / 圖表左上角錨定儲存格,例如
F1chartOdfChartDefinitionThe value to use. / 圖表定義
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddColorScaleFormat(OdfCellRange, OdfColor, OdfColor)
Short overload of AddColorScaleFormat that accepts range, minColor, and maxColor; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 range、minColor 與 maxColor;其餘可選參數使用預設值並轉呼叫最長 AddColorScaleFormat 多載。
public OdfSheetBuilder AddColorScaleFormat(OdfCellRange range, OdfColor minColor, OdfColor maxColor)
Parameters
rangeOdfCellRangeminColorOdfColormaxColorOdfColor
Returns
AddColorScaleFormat(OdfCellRange, OdfColor, OdfColor, OdfColor?)
Adds a color scale conditional format. 新增色階條件格式。
public OdfSheetBuilder AddColorScaleFormat(OdfCellRange range, OdfColor minColor, OdfColor maxColor, OdfColor? midColor)
Parameters
rangeOdfCellRangeThe cell range. / 儲存格範圍
minColorOdfColorThe numeric value. / 最小值對應色彩
maxColorOdfColorThe numeric value. / 最大值對應色彩
midColorOdfColor?The numeric value. / 中間值對應色彩
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddConditionalFormat(OdfCellRange, string, string)
Adds a conditional formatting rule. 新增條件格式規則。
public OdfSheetBuilder AddConditionalFormat(OdfCellRange range, string conditionValue, string styleName)
Parameters
rangeOdfCellRangeThe cell range. / 儲存格範圍
conditionValuestringThe value to use. / 條件運算式
styleNamestringThe name or identifier. / 要套用的格式樣式名稱
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddConditionalFormat(string, string, string)
Adds a conditional formatting rule. 新增條件格式規則。
public OdfSheetBuilder AddConditionalFormat(string range, string conditionValue, string styleName)
Parameters
rangestringThe cell range. / 儲存格範圍字串,例如
D2:D20conditionValuestringThe value to use. / 條件運算式
styleNamestringThe name or identifier. / 要套用的格式樣式名稱
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddDataBarFormat(OdfCellRange, OdfColor)
Short overload of AddDataBarFormat that accepts range and positiveColor; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 range 與 positiveColor;其餘可選參數使用預設值並轉呼叫最長 AddDataBarFormat 多載。
public OdfSheetBuilder AddDataBarFormat(OdfCellRange range, OdfColor positiveColor)
Parameters
rangeOdfCellRangepositiveColorOdfColor
Returns
AddDataBarFormat(OdfCellRange, OdfColor, OdfColor?)
Adds a data bar conditional format. 新增資料橫條條件格式。
public OdfSheetBuilder AddDataBarFormat(OdfCellRange range, OdfColor positiveColor, OdfColor? negativeColor)
Parameters
rangeOdfCellRangeThe cell range. / 儲存格範圍
positiveColorOdfColorThe numeric value. / 正值橫條色彩
negativeColorOdfColor?The numeric value. / 負值橫條色彩
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddDataValidation(OdfDataValidation)
Adds a data validation rule. 新增資料驗證規則。
public OdfSheetBuilder AddDataValidation(OdfDataValidation validation)
Parameters
validationOdfDataValidationThe value to use. / 資料驗證設定
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddDecimalValidation(OdfCellRange, double, double)
Adds a decimal numeric range data validation rule. 新增十進位數值範圍資料驗證規則。
public OdfSheetBuilder AddDecimalValidation(OdfCellRange range, double minimum, double maximum)
Parameters
rangeOdfCellRangeminimumdoublemaximumdouble
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddDecimalValidation(OdfCellRange, double, double, string?, string?)
Short overload of AddDecimalValidation that accepts range, minimum, maximum, errorTitle, and errorMessage; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 range、minimum、maximum、errorTitle 與 errorMessage;其餘可選參數使用預設值並轉呼叫最長 AddDecimalValidation 多載。
public OdfSheetBuilder AddDecimalValidation(OdfCellRange range, double minimum, double maximum, string? errorTitle, string? errorMessage)
Parameters
rangeOdfCellRangeminimumdoublemaximumdoubleerrorTitlestringerrorMessagestring
Returns
AddDecimalValidation(OdfCellRange, double, double, string?, string?, OdfValidationAlertStyle)
Full overload of AddDecimalValidation that accepts range, minimum, maximum, errorTitle, errorMessage, and alertStyle. AddDecimalValidation 完整多載:接受 range、minimum、maximum、errorTitle、errorMessage 與 alertStyle。
public OdfSheetBuilder AddDecimalValidation(OdfCellRange range, double minimum, double maximum, string? errorTitle, string? errorMessage, OdfValidationAlertStyle alertStyle)
Parameters
rangeOdfCellRangeminimumdoublemaximumdoubleerrorTitlestringerrorMessagestringalertStyleOdfValidationAlertStyle
Returns
AddDecimalValidation(string, double, double)
Adds a decimal numeric range data validation rule. 新增十進位數值範圍資料驗證規則。
public OdfSheetBuilder AddDecimalValidation(string range, double minimum, double maximum)
Parameters
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddDecimalValidation(string, double, double, string?, string?)
Short overload of AddDecimalValidation that accepts range, minimum, maximum, errorTitle, and errorMessage; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 range、minimum、maximum、errorTitle 與 errorMessage;其餘可選參數使用預設值並轉呼叫最長 AddDecimalValidation 多載。
public OdfSheetBuilder AddDecimalValidation(string range, double minimum, double maximum, string? errorTitle, string? errorMessage)
Parameters
Returns
AddDecimalValidation(string, double, double, string?, string?, OdfValidationAlertStyle)
Short overload of AddDecimalValidation that accepts range, minimum, maximum, errorTitle, errorMessage, and alertStyle; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 range、minimum、maximum、errorTitle、errorMessage 與 alertStyle;其餘可選參數使用預設值並轉呼叫最長 AddDecimalValidation 多載。
public OdfSheetBuilder AddDecimalValidation(string range, double minimum, double maximum, string? errorTitle, string? errorMessage, OdfValidationAlertStyle alertStyle)
Parameters
rangestringminimumdoublemaximumdoubleerrorTitlestringerrorMessagestringalertStyleOdfValidationAlertStyle
Returns
AddFormulaColumn(string, string, int, int, Func<int, string>)
Adds a formula column with a header cell and formulas for the specified data rows. 新增公式欄,包含標題儲存格與指定資料列的公式。
public OdfSheetBuilder AddFormulaColumn(string columnName, string header, int firstDataRow, int lastDataRow, Func<int, string> formulaFactory)
Parameters
columnNamestringThe name or identifier. / 欄位名稱,例如
DheaderstringThe name or identifier. / 標題列文字
firstDataRowintThe numeric value. / 第一筆資料列,採 1 為基準
lastDataRowintThe numeric value. / 最後一筆資料列,採 1 為基準
formulaFactoryFunc<int, string>The delegate to invoke. / 依 1-based 列號產生 ODF 公式文字的委派
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddFormulaColumn(string, string, int, int, Func<int, string>, Func<int, object?>)
Adds a formula column with cached values for the specified data rows. 新增公式欄,並為指定資料列寫入快取值。
public OdfSheetBuilder AddFormulaColumn(string columnName, string header, int firstDataRow, int lastDataRow, Func<int, string> formulaFactory, Func<int, object?> cachedValueFactory)
Parameters
columnNamestringThe column name, such as
D. / 欄位名稱,例如D。headerstringThe header text. / 標題列文字。
firstDataRowintThe first one-based data row. / 第一筆資料列,採 1 為基準。
lastDataRowintThe last one-based data row. / 最後一筆資料列,採 1 為基準。
formulaFactoryFunc<int, string>The formula factory using one-based row numbers. / 依 1 為基準列號產生 ODF 公式文字的委派。
cachedValueFactoryFunc<int, object>The cached value factory using one-based row numbers. / 依 1 為基準列號產生快取值的委派。
Returns
- OdfSheetBuilder
The current builder instance. / 目前 builder 執行個體。
AddFormulaColumn(string, string, int, int, Func<int, string>, Func<int, object?>, int)
Full overload of AddFormulaColumn that accepts columnName, header, firstDataRow, lastDataRow, and headerRow. AddFormulaColumn 完整多載:接受 columnName、header、firstDataRow、lastDataRow 與 headerRow。
public OdfSheetBuilder AddFormulaColumn(string columnName, string header, int firstDataRow, int lastDataRow, Func<int, string> formulaFactory, Func<int, object?> cachedValueFactory, int headerRow)
Parameters
columnNamestringheaderstringfirstDataRowintlastDataRowintformulaFactoryFunc<int, string>cachedValueFactoryFunc<int, object>headerRowint
Returns
AddFormulaColumn(string, string, int, int, Func<int, string>, int)
Full overload of AddFormulaColumn that accepts columnName, header, firstDataRow, lastDataRow, and headerRow. AddFormulaColumn 完整多載:接受 columnName、header、firstDataRow、lastDataRow 與 headerRow。
public OdfSheetBuilder AddFormulaColumn(string columnName, string header, int firstDataRow, int lastDataRow, Func<int, string> formulaFactory, int headerRow)
Parameters
columnNamestringheaderstringfirstDataRowintlastDataRowintformulaFactoryFunc<int, string>headerRowint
Returns
AddIconSetFormat(OdfCellRange, OdfIconSetType)
Adds an icon set conditional format. 新增圖示集條件格式。
public OdfSheetBuilder AddIconSetFormat(OdfCellRange range, OdfIconSetType iconSet)
Parameters
rangeOdfCellRangeThe cell range. / 儲存格範圍
iconSetOdfIconSetTypeThe value to use. / 圖示集類型
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddNamedExpression(string, string)
Short overload of AddNamedExpression that accepts name and expression; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 name 與 expression;其餘可選參數使用預設值並轉呼叫最長 AddNamedExpression 多載。
public OdfSheetBuilder AddNamedExpression(string name, string expression)
Parameters
Returns
AddNamedExpression(string, string, OdfCellAddress?)
Adds a worksheet-level named expression. 新增工作表層具名運算式。
public OdfSheetBuilder AddNamedExpression(string name, string expression, OdfCellAddress? baseCell)
Parameters
namestringThe name or identifier. / 具名運算式名稱
expressionstringThe value to use. / 公式運算式字串
baseCellOdfCellAddress?The cell address. / 基準儲存格位址
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddNamedRange(string, OdfCellRange)
Short overload of AddNamedRange that accepts name and range; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 name 與 range;其餘可選參數使用預設值並轉呼叫最長 AddNamedRange 多載。
public OdfSheetBuilder AddNamedRange(string name, OdfCellRange range)
Parameters
namestringrangeOdfCellRange
Returns
AddNamedRange(string, OdfCellRange, OdfCellAddress?)
Adds a worksheet-level named range. 新增工作表層命名範圍。
public OdfSheetBuilder AddNamedRange(string name, OdfCellRange range, OdfCellAddress? baseCell)
Parameters
namestringThe name or identifier. / 命名範圍名稱
rangeOdfCellRangeThe cell range. / 儲存格範圍
baseCellOdfCellAddress?The cell address. / 基準儲存格位址
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddNamedRange(string, string)
Adds a worksheet-level named range. 新增工作表層命名範圍。
public OdfSheetBuilder AddNamedRange(string name, string range)
Parameters
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddPivotTable(OdfCellRange, OdfCellAddress, Action<OdfPivotTableBuilder>)
Adds a pivot table. 新增樞紐分析表。
public OdfSheetBuilder AddPivotTable(OdfCellRange sourceRange, OdfCellAddress targetCell, Action<OdfPivotTableBuilder> configure)
Parameters
sourceRangeOdfCellRangeThe cell range. / 來源資料範圍
targetCellOdfCellAddressThe cell address. / 輸出起點儲存格
configureAction<OdfPivotTableBuilder>The delegate to invoke. / 樞紐分析表設定委派
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddPivotTable(string, OdfCellRange, OdfCellAddress, Action<OdfPivotTableBuilder>)
Adds a pivot table. 新增樞紐分析表。
public OdfSheetBuilder AddPivotTable(string name, OdfCellRange sourceRange, OdfCellAddress targetCell, Action<OdfPivotTableBuilder> configure)
Parameters
namestringThe name or identifier. / 樞紐分析表名稱
sourceRangeOdfCellRangeThe cell range. / 來源資料範圍
targetCellOdfCellAddressThe cell address. / 輸出起點儲存格
configureAction<OdfPivotTableBuilder>The delegate to invoke. / 樞紐分析表設定委派
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
AddPivotTable(string, string, string, Action<OdfPivotTableBuilder>)
Adds a pivot table. 新增樞紐分析表。
public OdfSheetBuilder AddPivotTable(string name, string sourceRange, string targetCell, Action<OdfPivotTableBuilder> configure)
Parameters
namestringThe name or identifier. / 樞紐分析表名稱
sourceRangestringThe cell range. / 來源資料範圍字串,例如
A1:D20targetCellstringThe cell address. / 輸出起點儲存格,例如
G1configureAction<OdfPivotTableBuilder>The delegate to invoke. / 樞紐分析表設定委派
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
FreezeAt(int, int)
Freezes panes above and to the left of the specified cell. 凍結指定儲存格上方與左側的窗格。
public OdfSheetBuilder FreezeAt(int row, int column)
Parameters
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
ImportRows<T>(IEnumerable<T>, Func<T, object?[]>)
Convenience overload that uses default values for remaining parameters. 便利多載:其餘參數使用預設值並轉呼叫最長多載。
public OdfSheetBuilder ImportRows<T>(IEnumerable<T> items, Func<T, object?[]> selector)
Parameters
itemsIEnumerable<T>selectorFunc<T, object[]>
Returns
Type Parameters
T
ImportRows<T>(IEnumerable<T>, Func<T, object?[]>, int)
Convenience overload that uses default values for remaining parameters. 便利多載:其餘參數使用預設值並轉呼叫最長多載。
public OdfSheetBuilder ImportRows<T>(IEnumerable<T> items, Func<T, object?[]> selector, int startRow)
Parameters
itemsIEnumerable<T>selectorFunc<T, object[]>startRowint
Returns
Type Parameters
T
ImportRows<T>(IEnumerable<T>, Func<T, object?[]>, int, int)
Imports row data. 匯入列資料。
public OdfSheetBuilder ImportRows<T>(IEnumerable<T> items, Func<T, object?[]> selector, int startRow, int startColumn)
Parameters
itemsIEnumerable<T>The value to use. / 要匯入的資料專案
selectorFunc<T, object[]>The delegate to invoke. / 將資料專案轉為儲存格值陣列的委派
startRowintThe numeric value. / 起始列,採 1 為基準
startColumnintThe numeric value. / 起始欄,採 1 為基準
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
Type Parameters
TThe type of item. / 資料專案型別
ImportTable<T>(IEnumerable<T>, Func<T, object?[]>, IEnumerable<string>)
Convenience overload that uses default values for remaining parameters. 便利多載:其餘參數使用預設值並轉呼叫最長多載。
public OdfSheetBuilder ImportTable<T>(IEnumerable<T> items, Func<T, object?[]> rowSelector, IEnumerable<string> headers)
Parameters
itemsIEnumerable<T>rowSelectorFunc<T, object[]>headersIEnumerable<string>
Returns
Type Parameters
T
ImportTable<T>(IEnumerable<T>, Func<T, object?[]>, IEnumerable<string>, int)
Convenience overload that uses default values for remaining parameters. 便利多載:其餘參數使用預設值並轉呼叫最長多載。
public OdfSheetBuilder ImportTable<T>(IEnumerable<T> items, Func<T, object?[]> rowSelector, IEnumerable<string> headers, int startRow)
Parameters
itemsIEnumerable<T>rowSelectorFunc<T, object[]>headersIEnumerable<string>startRowint
Returns
Type Parameters
T
ImportTable<T>(IEnumerable<T>, Func<T, object?[]>, IEnumerable<string>, int, int)
Imports a table with a header row. 匯入含標題列的資料表。
public OdfSheetBuilder ImportTable<T>(IEnumerable<T> items, Func<T, object?[]> rowSelector, IEnumerable<string> headers, int startRow, int startColumn)
Parameters
itemsIEnumerable<T>The value to use. / 要匯入的資料專案
rowSelectorFunc<T, object[]>The delegate to invoke. / 將資料專案轉為儲存格值陣列的委派
headersIEnumerable<string>The name or identifier. / 標題列文字
startRowintThe numeric value. / 標題列起始列,採 1 為基準
startColumnintThe numeric value. / 標題列起始欄,採 1 為基準
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
Type Parameters
TThe type of item. / 資料專案型別
InsertChart(OdfCellRange, OdfChartType)
Inserts an embedded chart into the current worksheet for immediate configuration. 在目前工作表插入可立即設定的嵌入圖表。
public OdfSheetBuilder InsertChart(OdfCellRange dataRange, OdfChartType chartType)
Parameters
dataRangeOdfCellRangechartTypeOdfChartType
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
InsertChart(OdfCellRange, OdfChartType, Action<OdfChartDocument>?)
Full overload of InsertChart that accepts dataRange, chartType, and configure. InsertChart 完整多載:接受 dataRange、chartType 與 configure。
public OdfSheetBuilder InsertChart(OdfCellRange dataRange, OdfChartType chartType, Action<OdfChartDocument>? configure)
Parameters
dataRangeOdfCellRangechartTypeOdfChartTypeconfigureAction<OdfChartDocument>
Returns
InsertChart(string, OdfChartType)
Inserts an embedded chart into the current worksheet for immediate configuration. 在目前工作表插入可立即設定的嵌入圖表。
public OdfSheetBuilder InsertChart(string dataRange, OdfChartType chartType)
Parameters
dataRangestringchartTypeOdfChartType
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
InsertChart(string, OdfChartType, Action<OdfChartDocument>?)
Short overload of InsertChart that accepts dataRange, chartType, and configure; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 dataRange、chartType 與 configure;其餘可選參數使用預設值並轉呼叫最長 InsertChart 多載。
public OdfSheetBuilder InsertChart(string dataRange, OdfChartType chartType, Action<OdfChartDocument>? configure)
Parameters
dataRangestringchartTypeOdfChartTypeconfigureAction<OdfChartDocument>
Returns
SetCell(string, object?)
Sets the value of the specified cell. 設定指定儲存格的值。
public OdfSheetBuilder SetCell(string address, object? value)
Parameters
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
SetColumnWidth(int, double)
Sets the column width. 設定欄寬。
public OdfSheetBuilder SetColumnWidth(int columnIndex, double widthCm)
Parameters
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
SetFormula(string, string)
Sets the formula for the specified cell. 設定指定儲存格的公式。
public OdfSheetBuilder SetFormula(string address, string formula)
Parameters
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
SetFormula(string, string, object?)
Sets the formula and cached value for the specified cell. 設定指定儲存格的公式與快取值。
public OdfSheetBuilder SetFormula(string address, string formula, object? cachedValue)
Parameters
addressstringThe cell address. / 儲存格位址,例如
A1。formulastringThe ODF formula text. / ODF 公式文字。
cachedValueobjectThe cached value stored with the formula. / 隨公式儲存的快取值。
Returns
- OdfSheetBuilder
The current builder instance. / 目前 builder 執行個體。
SetFormulaRange(OdfCellRange, Func<int, int, string>)
Sets formulas cell by cell across the specified cell range. 對指定儲存格範圍逐格設定公式。
public OdfSheetBuilder SetFormulaRange(OdfCellRange range, Func<int, int, string> formulaFactory)
Parameters
rangeOdfCellRangeThe cell range. / 要設定公式的儲存格範圍
formulaFactoryFunc<int, int, string>The delegate to invoke. / 依 1-based 列號與欄號產生 ODF 公式文字的委派
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體
SetFormulaRange(string, Func<int, int, string>)
Sets formulas cell by cell across the specified cell range. 對指定儲存格範圍逐格設定公式。
public OdfSheetBuilder SetFormulaRange(string range, Func<int, int, string> formulaFactory)
Parameters
rangestringThe cell range. / 儲存格範圍字串,例如
D2:D20formulaFactoryFunc<int, int, string>The delegate to invoke. / 依 1-based 列號與欄號產生 ODF 公式文字的委派
Returns
- OdfSheetBuilder
The result. / 目前 builder 執行個體