NameConverter
Converts between zero-based cell indices and Excel A1-style names (e.g., row 0 / column 1 to "B1") for use in formulas and display.
Definition
Namespace:Telerik.Windows.Documents.Spreadsheet.Utilities
Assembly:Telerik.Windows.Documents.Spreadsheet.dll
Syntax:
public static class NameConverter
Inheritance: objectNameConverter
Methods
Formats zero-based row and column indices into an A1-style range name (e.g., "A1:B10").
Parses an A1-style cell name into zero-based indices and detects absolute reference markers (e.g., "$A$1" sets both flags true).
public static void ConvertCellNameToIndex(string cellName, out bool isRowAbsolute, out int rowIndex, out bool isColumnAbsolute, out int columnIndex)
Name of the cell.
isRowAbsoluteboolThe value indicating whether the row is absolute.
rowIndexintIndex of the row.
isColumnAbsoluteboolThe value indicating whether the column is absolute.
columnIndexintIndex of the column.
Parses an A1-style cell name (e.g., "B1") into zero-based row and column indices, throwing on invalid input.
Formats a range defined by two CellReferences into an A1-style name, preserving absolute markers (e.g., "$A$1:$B$10").
public static string ConvertCellReferenceRangeToName(CellReference fromCellReference, CellReference toCellReference)
The start cell reference.
toCellReferenceCellReferenceThe end cell reference.
Returns:The name.
Formats a CellReference into an A1-style name, preserving absolute reference markers (e.g., $A$1).
public static string ConvertCellReferenceToName(CellReference cellReference)
The cell reference.
Returns:The name.
Tries to parse an A1-style cell name into indices and absolute flags, returning false if invalid.
public static bool TryConvertCellNameToIndex(string cellName, out bool isRowAbsolute, out int rowIndex, out bool isColumnAbsolute, out int columnIndex)
Name of the cell.
isRowAbsoluteboolThe is row absolute.
rowIndexintIndex of the row.
isColumnAbsoluteboolThe is column absolute.
columnIndexintIndex of the column.
Returns:Tries to parse an A1-style cell name (e.g., "B1") into zero-based indices, returning false if invalid or out of range.
Tries to parse an A1-style range name (e.g., "A1:B10", "1:5", "A:C") into a CellRange, returning false if invalid.
Parses a cell range name string (e.g., "A1:B10") into a CellReferenceRangeExpression relative to the specified cell position, returning false if invalid.
public static bool TryConvertNamesToCellReferenceRangeExpression(string cellRangesNames, Worksheet worksheet, int rowIndex, int columnIndex, out CellReferenceRangeExpression expression)
The cell ranges names.
worksheetWorksheetThe worksheet.
rowIndexintThe row index of the cell for which the expression is created.
columnIndexintThe column index of the cell for which the expression is created.
expressionCellReferenceRangeExpressionThe expression.
Returns:True if converter successfuly, else false.