Skip to content

GetExcelColumnName.cs

Avrigeanu Laurian edited this page Apr 12, 2023 · 1 revision

GetExcelColumnName (columnNumber: int)

Parameters

  • columnNumber: An integer representing the column number in the Excel sheet.

Returns

  • A string representing the column name in the Excel sheet.

Remarks

This method takes an integer as an input representing the column number in the Excel sheet and returns a string representing the column name. The returned column name is the alphabetic representation of the column number, starting from 'A' for column 1, 'B' for column 2, and so on. The algorithm used in this method is an iterative process that converts the column number to its alphabetic representation.


GetExcelColumnNameModern (columnNumber: int)

Parameters

  • columnNumber: An integer representing the column number in the Excel sheet.

Returns

  • A string representing the column name in the Excel sheet.

Remarks

This method takes an integer as an input representing the column number in the Excel sheet and returns a string representing the column name. The returned column name is the alphabetic representation of the column number, starting from 'A' for column 1, 'B' for column 2, and so on. The algorithm used in this method is an iterative process that converts the column number to its alphabetic representation. This method is optimized for performance by using a character array of fixed length to store the column name. It also avoids unnecessary string concatenation by using the new string() constructor to create the final string from the character array.

Clone this wiki locally