Struct OdfCellAddress
- Namespace
- OdfKit.Spreadsheet
- Assembly
- OdfKit.dll
Represents a cell address in an ODF spreadsheet. 表示 ODF 試算表中的儲存格位址。
public readonly struct OdfCellAddress : IEquatable<OdfCellAddress>
- Implements
- Inherited Members
Constructors
OdfCellAddress(int, int)
Short overload of OdfCellAddress that accepts row and column; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 row 與 column;其餘可選參數使用預設值並轉呼叫最長 OdfCellAddress 多載。
public OdfCellAddress(int row, int column)
Parameters
OdfCellAddress(int, int, string?)
Short overload of OdfCellAddress that accepts row, column, and sheetName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 row、column 與 sheetName;其餘可選參數使用預設值並轉呼叫最長 OdfCellAddress 多載。
public OdfCellAddress(int row, int column, string? sheetName)
Parameters
OdfCellAddress(int, int, string?, bool)
Short overload of OdfCellAddress that accepts row, column, sheetName, and isRowAbsolute; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 row、column、sheetName 與 isRowAbsolute;其餘可選參數使用預設值並轉呼叫最長 OdfCellAddress 多載。
public OdfCellAddress(int row, int column, string? sheetName, bool isRowAbsolute)
Parameters
OdfCellAddress(int, int, string?, bool, bool)
Short overload of OdfCellAddress that accepts row, column, sheetName, isRowAbsolute, and isColumnAbsolute; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 row、column、sheetName、isRowAbsolute 與 isColumnAbsolute;其餘可選參數使用預設值並轉呼叫最長 OdfCellAddress 多載。
public OdfCellAddress(int row, int column, string? sheetName, bool isRowAbsolute, bool isColumnAbsolute)
Parameters
OdfCellAddress(int, int, string?, bool, bool, bool)
Initializes a new instance of the OdfCellAddress struct. 初始化 OdfCellAddress 結構的新執行個體。
public OdfCellAddress(int row, int column, string? sheetName, bool isRowAbsolute, bool isColumnAbsolute, bool isSheetAbsolute)
Parameters
rowintThe zero-based row index. / 採 0 為基準的列索引。
columnintThe zero-based column index. / 採 0 為基準的欄索引。
sheetNamestringThe sheet name. / 工作表名稱。
isRowAbsoluteboolWhether the row index is an absolute reference. / 列索引是否為絕對參照。
isColumnAbsoluteboolWhether the column index is an absolute reference. / 欄索引是否為絕對參照。
isSheetAbsoluteboolWhether the sheet name is an absolute reference. / 工作表名稱是否為絕對參照。
Exceptions
- ArgumentOutOfRangeException
Thrown when the row or column index is less than 0. / 當列索引或欄索引小於 0 時擲出。
Properties
Column
Gets the zero-based column index. 取得以 0 為基準的欄索引。
public int Column { get; }
Property Value
IsColumnAbsolute
Gets a value indicating whether the column index is an absolute reference. 取得一個值,指出欄索引是否為絕對參照。
public bool IsColumnAbsolute { get; }
Property Value
IsRowAbsolute
Gets a value indicating whether the row index is an absolute reference. 取得一個值,指出列索引是否為絕對參照。
public bool IsRowAbsolute { get; }
Property Value
IsSheetAbsolute
Gets a value indicating whether the sheet name is an absolute reference. 取得一個值,指出工作表名稱是否為絕對參照。
public bool IsSheetAbsolute { get; }
Property Value
Row
Gets the zero-based row index. 取得以 0 為基準的列索引。
public int Row { get; }
Property Value
SheetName
Gets the sheet name. 取得工作表名稱。
public string? SheetName { get; }
Property Value
Methods
Equals(OdfCellAddress)
Indicates whether the current instance is equal to another instance of the same type. 指出目前執行個體是否等於另一個相同類型的執行個體。
public bool Equals(OdfCellAddress other)
Parameters
otherOdfCellAddressThe 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 位元有號整數雜湊碼。
Parse(ReadOnlySpan<char>, bool)
Parses a cell address from a character span. 從字元範圍解析儲存格位址。
public static OdfCellAddress Parse(ReadOnlySpan<char> span, bool isOdfStyle)
Parameters
spanReadOnlySpan<char>The read-only character span containing the cell address. / 包含儲存格位址的唯讀字元範圍。
isOdfStyleboolWhether to use ODF-style formatting. / 是否使用 ODF 格式樣式。
Returns
- OdfCellAddress
The parsed OdfCellAddress struct. / 解析後的 OdfCellAddress 結構。
Exceptions
- FormatException
Thrown when the string format is invalid. / 當字串格式無效時擲出。
ParseExcel(string)
Parses an Excel-style cell address string. 解析 Excel 格式的儲存格位址字串。
public static OdfCellAddress ParseExcel(string address)
Parameters
addressstringThe Excel-style address string. / Excel 格式的位址字串。
Returns
- OdfCellAddress
The parsed OdfCellAddress instance. / 解析後的 OdfCellAddress 執行個體。
ParseOdf(string)
Parses an ODF-style cell address string. 解析 ODF 格式的儲存格位址字串。
public static OdfCellAddress ParseOdf(string address)
Parameters
addressstringThe ODF-style address string. / ODF 格式的位址字串。
Returns
- OdfCellAddress
The parsed OdfCellAddress instance. / 解析後的 OdfCellAddress 執行個體。
ShiftStructural(int, int, int, int)
Adjusts the cell address according to row or column insertion and deletion. 根據列或欄的插入或刪除,調整儲存格位址。
public OdfCellAddress 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
- OdfCellAddress
The adjusted new OdfCellAddress instance. / 調整後的新 OdfCellAddress 執行個體。
ToExcelString()
Converts this cell address to an Excel-style string. 將此儲存格位址轉換為 Excel 格式的字串。
public string ToExcelString()
Returns
- string
The Excel-style address 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 cell address to an ODF-style string. 將此儲存格位址轉換為 ODF 格式的字串。
public string ToOdfString(bool includeBrackets)
Parameters
includeBracketsboolWhether to include brackets. / 是否包含中括號。
Returns
- string
The ODF-style address 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 OdfCellAddress)
Attempts to parse a cell address string. 嘗試解析儲存格位址字串。
public static bool TryParse(string value, out OdfCellAddress address)
Parameters
valuestringThe address string to parse. / 要解析的位址字串。
addressOdfCellAddressThe cell address returned when parsing succeeds. / 解析成功時傳回的儲存格位址。
Returns
Operators
operator ==(OdfCellAddress, OdfCellAddress)
Compares two OdfCellAddress instances for equality. 比較兩個 OdfCellAddress 執行個體是否相等。
public static bool operator ==(OdfCellAddress left, OdfCellAddress right)
Parameters
leftOdfCellAddressThe left instance. / 左方的執行個體。
rightOdfCellAddressThe right instance. / 右方的執行個體。
Returns
operator !=(OdfCellAddress, OdfCellAddress)
Compares two OdfCellAddress instances for inequality. 比較兩個 OdfCellAddress 執行個體是否不相等。
public static bool operator !=(OdfCellAddress left, OdfCellAddress right)
Parameters
leftOdfCellAddressThe left instance. / 左方的執行個體。
rightOdfCellAddressThe right instance. / 右方的執行個體。