ClassNameConverter
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
ConvertCellIndexToName(CellIndex)
Formats a CellIndex into an A1-style cell name (e.g., row 0, column 1 to "B1").
ConvertCellIndexToName(int, int)
Combines a zero-based row and column index into an A1-style cell name (e.g., row 0, column 1 to "B1").
ConvertCellIndexesToName(int, int, int, int)
Formats zero-based row and column indices into an A1-style range name (e.g., "A1:B10").
Declaration
public static string ConvertCellIndexesToName(int fromRowIndex, int fromColumnIndex, int toRowIndex, int toColumnIndex)
Parameters
fromRowIndex
The start row index.
fromColumnIndex
The start column index.
toRowIndex
The end row index.
toColumnIndex
The end column index.
Returns
The name.
ConvertCellNameToIndex(string, out bool, out int, out bool, out int)
Parses an A1-style cell name into zero-based indices and detects absolute reference markers (e.g., "$A$1" sets both flags true).
Declaration
public static void ConvertCellNameToIndex(string cellName, out bool isRowAbsolute, out int rowIndex, out bool isColumnAbsolute, out int columnIndex)
Parameters
cellName
Name of the cell.
isRowAbsolute
The value indicating whether the row is absolute.
rowIndex
Index of the row.
isColumnAbsolute
The value indicating whether the column is absolute.
columnIndex
Index of the column.
ConvertCellNameToIndex(string, out int, out int)
Parses an A1-style cell name (e.g., "B1") into zero-based row and column indices, throwing on invalid input.
ConvertCellRangeToName(CellIndex, CellIndex)
Formats a cell range into an A1-style name (e.g., "A1:B10"), detecting full-row or full-column ranges.
ConvertCellRangeToName(CellRange)
Formats a CellRange into an A1-style name (e.g., "A1:B10"), detecting full-row or full-column ranges.
ConvertCellReferenceRangeToName(CellReference, CellReference)
Formats a range defined by two CellReferences into an A1-style name, preserving absolute markers (e.g., "$A$1:$B$10").
Declaration
public static string ConvertCellReferenceRangeToName(CellReference fromCellReference, CellReference toCellReference)
Parameters
fromCellReference
The start cell reference.
toCellReference
The end cell reference.
Returns
The name.
ConvertCellReferenceToName(CellReference)
Formats a CellReference into an A1-style name, preserving absolute reference markers (e.g., $A$1).
Declaration
public static string ConvertCellReferenceToName(CellReference cellReference)
Parameters
cellReference
The cell reference.
Returns
The name.
ConvertColumnIndexToName(int)
Converts a zero-based column index to its Excel alphabetic column name (e.g., 0 to "A", 25 to "Z", 26 to "AA").
ConvertColumnNameToIndex(string)
Parses an Excel alphabetic column name (e.g., "A", "Z", "AA") to a zero-based column index, throwing on invalid input.
ConvertRowIndexToName(int)
Converts a zero-based row index to its 1-based Excel row name (e.g., 0 to "1", 999 to "1000").
ConvertRowNameToIndex(string)
Parses a 1-based Excel row name (e.g., "1", "1000") to a zero-based row index, throwing on invalid input.
IsValidA1CellName(string)
Validates whether a string is a valid A1-style cell name (e.g., "A1", "$B$10") within worksheet bounds.
TryConvertCellNameToIndex(string, out bool, out int, out bool, out int)
Tries to parse an A1-style cell name into indices and absolute flags, returning false if invalid.
Declaration
public static bool TryConvertCellNameToIndex(string cellName, out bool isRowAbsolute, out int rowIndex, out bool isColumnAbsolute, out int columnIndex)
Parameters
cellName
Name of the cell.
isRowAbsolute
The is row absolute.
rowIndex
Index of the row.
isColumnAbsolute
The is column absolute.
columnIndex
Index of the column.
Returns
TryConvertCellNameToIndex(string, out int, out int)
Tries to parse an A1-style cell name (e.g., "B1") into zero-based indices, returning false if invalid or out of range.
Declaration
public static bool TryConvertCellNameToIndex(string cellName, out int rowIndex, out int columnIndex)
Parameters
cellName
Name of the cell.
rowIndex
Index of the row.
columnIndex
Index of the column.
Returns
The value indicating whether the conversion was successful.
TryConvertCellRangeNameToCellRange(string, out CellRange)
Tries to parse an A1-style range name (e.g., "A1:B10", "1:5", "A:C") into a CellRange, returning false if invalid.
TryConvertNamesToCellReferenceRangeExpression(string, Worksheet, int, int, out CellReferenceRangeExpression)
Parses a cell range name string (e.g., "A1:B10") into a CellReferenceRangeExpression relative to the specified cell position, returning false if invalid.
Declaration
public static bool TryConvertNamesToCellReferenceRangeExpression(string cellRangesNames, Worksheet worksheet, int rowIndex, int columnIndex, out CellReferenceRangeExpression expression)
Parameters
cellRangesNames
The cell ranges names.
worksheet
The worksheet.
rowIndex
The row index of the cell for which the expression is created.
columnIndex
The column index of the cell for which the expression is created.
expression
The expression.
Returns
True if converter successfuly, else false.