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
startOdfCellAddressThe start cell address. / 起始儲存格位址。
endOdfCellAddressThe 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
startRowintThe start row index. / 起始列索引。
startColintThe start column index. / 起始欄索引。
endRowintThe end row index. / 結束列索引。
endColintThe end column index. / 結束欄索引。
sheetNamestringThe sheet name. / 工作表名稱。
Properties
EndAddress
Gets the end cell address of the range. 取得範圍的結束儲存格位址。
public OdfCellAddress EndAddress { get; }
Property Value
StartAddress
Gets the start cell address of the range. 取得範圍的起始儲存格位址。
public OdfCellAddress StartAddress { get; }
Property Value
Methods
Contains(OdfCellAddress)
Determines whether this range contains the specified cell address. 判斷此範圍是否包含指定的儲存格位址。
public bool Contains(OdfCellAddress address)
Parameters
addressOdfCellAddressThe cell address to check. / 要檢查的儲存格位址。
Returns
Equals(OdfCellRange)
Indicates whether the current instance is equal to another instance of the same type. 指出目前執行個體是否等於另一個相同類型的執行個體。
public bool Equals(OdfCellRange other)
Parameters
otherOdfCellRangeThe other instance to compare. / 要比較的另一個執行個體。
Returns
Equals(object?)
Indicates whether this instance and the specified object are equal. 指出此執行個體與指定的物件是否相等。
public override bool Equals(object? obj)
Parameters
objobjectThe 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
otherOdfCellRangeThe 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
otherOdfCellRangeThe other range to check. / 要檢查的另一個範圍。
Returns
ParseExcel(string)
Parses an Excel-style cell range string. 解析 Excel 格式的儲存格範圍字串。
public static OdfCellRange ParseExcel(string rangeStr)
Parameters
rangeStrstringThe 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
rangeStrstringThe 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
insertRowIndexintThe row insertion index. / 插入列的索引位置。
rowCountintThe number of inserted rows; a negative value indicates deletion. / 插入的列數;負數表示刪除。
insertColIndexintThe column insertion index. / 插入欄的索引位置。
colCountintThe 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
ToOdfString(bool)
Converts this range to an ODF-style string. 將此範圍轉換為 ODF 格式的字串。
public string ToOdfString(bool includeBrackets)
Parameters
includeBracketsboolWhether 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
valuestringThe range string to parse. / 要解析的範圍字串。
rangeOdfCellRangeThe cell range returned when parsing succeeds. / 解析成功時傳回的儲存格範圍。
Returns
Operators
operator ==(OdfCellRange, OdfCellRange)
Compares two OdfCellRange instances for equality. 比較兩個 OdfCellRange 執行個體是否相等。
public static bool operator ==(OdfCellRange left, OdfCellRange right)
Parameters
leftOdfCellRangeThe left instance. / 左方的執行個體。
rightOdfCellRangeThe right instance. / 右方的執行個體。
Returns
operator !=(OdfCellRange, OdfCellRange)
Compares two OdfCellRange instances for inequality. 比較兩個 OdfCellRange 執行個體是否不相等。
public static bool operator !=(OdfCellRange left, OdfCellRange right)
Parameters
leftOdfCellRangeThe left instance. / 左方的執行個體。
rightOdfCellRangeThe right instance. / 右方的執行個體。