Table of Contents

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

row int
column int

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

row int
column int
sheetName string

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

row int
column int
sheetName string
isRowAbsolute bool

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

row int
column int
sheetName string
isRowAbsolute bool
isColumnAbsolute bool

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

row int

The zero-based row index. / 採 0 為基準的列索引。

column int

The zero-based column index. / 採 0 為基準的欄索引。

sheetName string

The sheet name. / 工作表名稱。

isRowAbsolute bool

Whether the row index is an absolute reference. / 列索引是否為絕對參照。

isColumnAbsolute bool

Whether the column index is an absolute reference. / 欄索引是否為絕對參照。

isSheetAbsolute bool

Whether 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

int

IsColumnAbsolute

Gets a value indicating whether the column index is an absolute reference. 取得一個值,指出欄索引是否為絕對參照。

public bool IsColumnAbsolute { get; }

Property Value

bool

IsRowAbsolute

Gets a value indicating whether the row index is an absolute reference. 取得一個值,指出列索引是否為絕對參照。

public bool IsRowAbsolute { get; }

Property Value

bool

IsSheetAbsolute

Gets a value indicating whether the sheet name is an absolute reference. 取得一個值,指出工作表名稱是否為絕對參照。

public bool IsSheetAbsolute { get; }

Property Value

bool

Row

Gets the zero-based row index. 取得以 0 為基準的列索引。

public int Row { get; }

Property Value

int

SheetName

Gets the sheet name. 取得工作表名稱。

public string? SheetName { get; }

Property Value

string

Methods

Equals(OdfCellAddress)

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

public bool Equals(OdfCellAddress other)

Parameters

other OdfCellAddress

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 位元有號整數雜湊碼。

Parse(ReadOnlySpan<char>, bool)

Parses a cell address from a character span. 從字元範圍解析儲存格位址。

public static OdfCellAddress Parse(ReadOnlySpan<char> span, bool isOdfStyle)

Parameters

span ReadOnlySpan<char>

The read-only character span containing the cell address. / 包含儲存格位址的唯讀字元範圍。

isOdfStyle bool

Whether 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

address string

The 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

address string

The 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

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

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

string

ToOdfString(bool)

Converts this cell address to an ODF-style string. 將此儲存格位址轉換為 ODF 格式的字串。

public string ToOdfString(bool includeBrackets)

Parameters

includeBrackets bool

Whether 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

value string

The address string to parse. / 要解析的位址字串。

address OdfCellAddress

The cell address returned when parsing succeeds. / 解析成功時傳回的儲存格位址。

Returns

bool

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

Operators

operator ==(OdfCellAddress, OdfCellAddress)

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

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

Parameters

left OdfCellAddress

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

right OdfCellAddress

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

Returns

bool

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

operator !=(OdfCellAddress, OdfCellAddress)

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

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

Parameters

left OdfCellAddress

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

right OdfCellAddress

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

Returns

bool

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