Skip to content

ExcelConverter

ExcelConverter is a concrete ConverterBase subclass that represents base 26 using Excel-style, bijective spreadsheet column-letter semantics (A, B, … Z, AA, AB, …, with no zero digit). It overrides Base, ConvertNumericToAlpha, ConvertAlphaToNumeric, and FormatBaseN.

Purpose

  • Provide an IConverter implementation that reproduces Excel/spreadsheet-style column naming for base-26 conversion.*

Context

  • Namespace: SAIF.Framework.BaseN
  • Assembly/package: SAIF.Framework.BaseN (also bundled into the SAIF.BOF.Framework NuGet package)

Public members

Member Signature Purpose
Base Public Overrides ReadOnly Property Base() As Integer Returns 26.
ConvertNumericToAlpha Public Overrides Function ConvertNumericToAlpha(ByVal input As Integer) As String Maps 1–26 to "A"–"Z" via Chr(64 + input); throws ConverterException if input > Base (BR-002).
ConvertAlphaToNumeric Public Overrides Function ConvertAlphaToNumeric(ByVal input As String) As Integer Accepts single characters only; numeric input passes through; letters mapped via Asc(input.ToUpper) - 64, bounds-checked against Base, throwing ConverterException if exceeded (BR-002). Returns -1 if input length is not 1.*
FormatBaseN Public Overrides Function FormatBaseN(ByVal values As Integer()) As String Renders a digit array right-to-left, applying bijective base-26 carry logic: a zero digit is replaced with 26 and the preceding digit is decremented/rolled, so no digit position ever renders as "0" (BR-003).

Behavioral notes

  • FormatBaseN mutates the input values array in place while resolving carries (rollover) between digit positions.*
  • ConvertAlphaToNumeric returns -1 for multi-character or empty input rather than throwing, which differs from the single-character assumption used elsewhere in the type.*

Constraints and usage notes

  • Callers must catch ConverterException when passing potentially out-of-range digit values.
  • Input to ConvertAlphaToNumeric is expected to be a single character; multi-character input yields -1 rather than an exception.*

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified. Statements marked with † were retrieved from dependency library documentation via the Legends CLI RAG service. They describe inherited behavior from the indicated origin library and should be verified if the dependency version changes.

Sources

  • SAIF.Framework.BaseN\ExcelConverter.vb
  • SAIF.Framework.BaseN\ConverterBase.vb
  • SAIF.Framework.BaseN\ConverterException.vb