Table of Contents

Struct OdfCellRange

Namespace
OdfKit.Spreadsheet
Assembly
OdfKit.dll

Represents a cell range in an ODF spreadsheet. 表示 ODF 試算表中的儲存格範圍。

public readonly struct OdfCellRange : IEquatable<OdfCellRange>
Implements
Inherited Members

Remarks

Initializes a new instance of the OdfCellRange struct. 初始化 OdfCellRange 結構的新執行個體。

Constructors

OdfCellRange(OdfCellAddress, OdfCellAddress)

Represents a cell range in an ODF spreadsheet. 表示 ODF 試算表中的儲存格範圍。

public OdfCellRange(OdfCellAddress start, OdfCellAddress end)

Parameters

start OdfCellAddress

The start cell address. / 起始儲存格位址。

end OdfCellAddress

The end cell address. / 結束儲存格位址。

Remarks

Initializes a new instance of the OdfCellRange struct. 初始化 OdfCellRange 結構的新執行個體。

OdfCellRange(int, int, int, int, string?)

Initializes a new instance of the OdfCellRange struct. 初始化 OdfCellRange 結構的新執行個體。

public OdfCellRange(int startRow, int startCol, int endRow, int endCol, string? sheetName = null)

Parameters

startRow int

The start row index. / 起始列索引。

startCol int

The start column index. / 起始欄索引。

endRow int

The end row index. / 結束列索引。

endCol int

The end column index. / 結束欄索引。

sheetName string

The sheet name. / 工作表名稱。

Properties

EndAddress

Gets the end cell address of the range. 取得範圍的結束儲存格位址。

public OdfCellAddress EndAddress { get; }

Property Value

OdfCellAddress

StartAddress

Gets the start cell address of the range. 取得範圍的起始儲存格位址。

public OdfCellAddress StartAddress { get; }

Property Value

OdfCellAddress

Methods

Contains(OdfCellAddress)

Determines whether this range contains the specified cell address. 判斷此範圍是否包含指定的儲存格位址。

public bool Contains(OdfCellAddress address)

Parameters

address OdfCellAddress

The cell address to check. / 要檢查的儲存格位址。

Returns

bool

true if the range contains the address; otherwise, false. / 如果包含則為 true,否則為 false

Equals(OdfCellRange)

Indicates whether the current instance is equal to another instance of the same type. 指出目前執行個體是否等於另一個相同類型的執行個體。

public bool Equals(OdfCellRange other)

Parameters

other OdfCellRange

The other instance to compare. / 要比較的另一個執行個體。

Returns

bool

true if the two instances are equal; otherwise, false. / 如果兩個執行個體相等則為 true,否則為 false

Equals(object?)

Indicates whether this instance and the specified object are equal. 指出此執行個體與指定的物件是否相等。

public override bool Equals(object? obj)

Parameters

obj object

The object to compare. / 要比較的物件。

Returns

bool

true if the specified object equals the current instance; otherwise, false. / 如果指定的物件與目前執行個體相等則為 true,否則為 false

GetHashCode()

Returns the hash code for this instance. 傳回此執行個體的雜湊碼。

public override int GetHashCode()

Returns

int

A 32-bit signed integer hash code. / 32 位元有號整數雜湊碼。

Intersect(OdfCellRange)

Calculates the intersection between this range and another range. 計算此範圍與另一個範圍的相交區域。

public OdfCellRange? Intersect(OdfCellRange other)

Parameters

other OdfCellRange

The other cell range. / 另一個儲存格範圍。

Returns

OdfCellRange?

The intersecting OdfCellRange, or null if the ranges do not intersect. / 相交的 OdfCellRange,如果不相交則為 null

Intersects(OdfCellRange)

Determines whether this range intersects another range. 判斷此範圍是否與另一個範圍相交。

public bool Intersects(OdfCellRange other)

Parameters

other OdfCellRange

The other range to check. / 要檢查的另一個範圍。

Returns

bool

true if the ranges intersect; otherwise, false. / 如果相交則為 true,否則為 false

ParseExcel(string)

Parses an Excel-style cell range string. 解析 Excel 格式的儲存格範圍字串。

public static OdfCellRange ParseExcel(string rangeStr)

Parameters

rangeStr string

The Excel-style range string. / Excel 格式的範圍字串。

Returns

OdfCellRange

The parsed OdfCellRange instance. / 解析後的 OdfCellRange 執行個體。

ParseOdf(string)

Parses an ODF-style cell range string. 解析 ODF 格式的儲存格範圍字串。

public static OdfCellRange ParseOdf(string rangeStr)

Parameters

rangeStr string

The ODF-style range string. / ODF 格式的範圍字串。

Returns

OdfCellRange

The parsed OdfCellRange instance. / 解析後的 OdfCellRange 執行個體。

ShiftStructural(int, int, int, int)

Adjusts the cell range according to row or column insertion and deletion. 根據列或欄的插入或刪除,調整儲存格範圍。

public OdfCellRange ShiftStructural(int insertRowIndex, int rowCount, int insertColIndex, int colCount)

Parameters

insertRowIndex int

The row insertion index. / 插入列的索引位置。

rowCount int

The number of inserted rows; a negative value indicates deletion. / 插入的列數;負數表示刪除。

insertColIndex int

The column insertion index. / 插入欄的索引位置。

colCount int

The number of inserted columns; a negative value indicates deletion. / 插入的欄數;負數表示刪除。

Returns

OdfCellRange

The adjusted new OdfCellRange instance. / 調整後的新 OdfCellRange 執行個體。

ToExcelString()

Converts this range to an Excel-style string. 將此範圍轉換為 Excel 格式的字串。

public string ToExcelString()

Returns

string

The Excel-style range representation string. / Excel 格式的範圍表示字串。

ToOdfString()

Short overload of ToOdfString that uses default values for all optional parameters and forwards to the full overload. 便利多載:ToOdfString 的所有可選參數使用預設值並轉呼叫最長多載。

public string ToOdfString()

Returns

string

ToOdfString(bool)

Converts this range to an ODF-style string. 將此範圍轉換為 ODF 格式的字串。

public string ToOdfString(bool includeBrackets)

Parameters

includeBrackets bool

Whether to include brackets. / 是否包含中括號。

Returns

string

The ODF-style range representation string. / ODF 格式的範圍表示字串。

ToString()

Returns a string that represents the current object. 傳回代表目前物件的字串。

public override string ToString()

Returns

string

A string that represents the current object. / 代表目前物件的字串。

TryParse(string, out OdfCellRange)

Attempts to parse a cell range string. 嘗試解析儲存格範圍字串。

public static bool TryParse(string value, out OdfCellRange range)

Parameters

value string

The range string to parse. / 要解析的範圍字串。

range OdfCellRange

The cell range returned when parsing succeeds. / 解析成功時傳回的儲存格範圍。

Returns

bool

true if parsing succeeds; otherwise, false. / 如果解析成功則為 true,否則為 false

Operators

operator ==(OdfCellRange, OdfCellRange)

Compares two OdfCellRange instances for equality. 比較兩個 OdfCellRange 執行個體是否相等。

public static bool operator ==(OdfCellRange left, OdfCellRange right)

Parameters

left OdfCellRange

The left instance. / 左方的執行個體。

right OdfCellRange

The right instance. / 右方的執行個體。

Returns

bool

true if the instances are equal; otherwise, false. / 如果相等則為 true,否則為 false

operator !=(OdfCellRange, OdfCellRange)

Compares two OdfCellRange instances for inequality. 比較兩個 OdfCellRange 執行個體是否不相等。

public static bool operator !=(OdfCellRange left, OdfCellRange right)

Parameters

left OdfCellRange

The left instance. / 左方的執行個體。

right OdfCellRange

The right instance. / 右方的執行個體。

Returns

bool

true if the instances are not equal; otherwise, false. / 如果不相等則為 true,否則為 false