Table of Contents

Class OdfCellRangeSelection

Namespace
OdfKit.Spreadsheet
Assembly
OdfKit.dll

Represents a range selection in a worksheet. 表示工作表中的一個範圍選取。

public sealed class OdfCellRangeSelection
Inheritance
OdfCellRangeSelection
Inherited Members

Properties

Borders

Gets the border configuration proxy for this range. 取得此範圍的框線設定代理。

public OdfRangeBorderProxy Borders { get; }

Property Value

OdfRangeBorderProxy

HorizontalAlignment

Gets or sets the horizontal alignment for all cells in this range. 取得或設定此範圍所有儲存格的水平對齊方式。

public string? HorizontalAlignment { get; set; }

Property Value

string

IsProtected

Gets a value indicating whether this range is protected. 取得一個值,指出此範圍是否已啟用保護。

public bool IsProtected { get; }

Property Value

bool

Range

Gets the cell range represented by this selection. 取得此選取代表的儲存格範圍。

public OdfCellRange Range { get; }

Property Value

OdfCellRange

Methods

AddConditionalFormat(string, string)

Adds conditional formatting to this range. 為此範圍新增條件格式。

public void AddConditionalFormat(string condition, string styleName)

Parameters

condition string

The condition expression. / 條件運算式。

styleName string

The style name to apply. / 套用的樣式名稱。

AddFilter(string, params (int fieldNumber, string op, string value)[])

Adds a filter to this range. 為此範圍新增篩選。

public void AddFilter(string name, params (int fieldNumber, string op, string value)[] conditions)

Parameters

name string

The database range name. / 資料庫範圍名稱。

conditions (int fieldNumber, string op, string value)[]

The filter conditions. / 篩選條件。

AddValidationList(string, params string[])

Adds list-based data validation to this range. 為此範圍新增清單型資料驗證。

public void AddValidationList(string name, params string[] allowedValues)

Parameters

name string

The validation rule name. / 驗證規則名稱。

allowedValues string[]

The allowed values. / 允許的值。

AutoFilter()

Enables auto-filter buttons for this range. 為此範圍啟用自動篩選按鈕。

public OdfCellRangeSelection AutoFilter()

Returns

OdfCellRangeSelection

This range selection object for chaining. / 此範圍選取物件,方便鏈式呼叫。

Merge()

Merges the cells in this range. 合併此範圍的儲存格。

public void Merge()

NameAs(string)

Adds this range as a named range. 將此範圍加入命名範圍。

public void NameAs(string name)

Parameters

name string

The named range name. / 命名範圍名稱。

Protect(string)

Protects this range with the specified password and writes it to the protected range map of the worksheet. 以指定密碼保護此範圍,將其寫入工作表的受保護範圍對照表中。

public void Protect(string password)

Parameters

password string

The plain text password. / 密碼明文。

Sort(params (int fieldNumber, bool ascending)[])

Sets sort rules for this range. 為此範圍設定排序規則。

public OdfCellRangeSelection Sort(params (int fieldNumber, bool ascending)[] rules)

Parameters

rules (int fieldNumber, bool ascending)[]

The sort rule array, containing field numbers and whether each field is ascending. / 排序規則陣列,包含欄位編號與是否遞增。

Returns

OdfCellRangeSelection

This range selection object for chaining. / 此範圍選取物件,方便鏈式呼叫。

TryUnprotect(string)

Attempts to remove protection from this range with the specified password. 嘗試以指定密碼解除此範圍的保護。

public bool TryUnprotect(string password)

Parameters

password string

The plain text password. / 密碼明文。

Returns

bool

true if protection is removed successfully; otherwise, false. / 若解除成功則為 true,否則為 false

Unmerge()

Unmerges the cells in this range. 取消合併此範圍的儲存格。

public void Unmerge()

Unprotect()

Removes protection from this range. 解除此範圍的保護。

public void Unprotect()

VerifyPassword(string)

Verifies whether the given password can unlock this range. 驗證給定密碼是否能解除此範圍的保護。

public bool VerifyPassword(string password)

Parameters

password string

The password to verify. / 要驗證的密碼。

Returns

bool

true if verification succeeds; otherwise, false. / 若驗證成功則為 true,否則為 false