LitterBox/ReportGenerators/ExcelHandler.cs
/// <summary>
/// Converts an int to an excel column name. <br/><br/>
/// Code provided by Graham on Stack Overflow <br/>(https://stackoverflow.com/questions/181596/how-to-convert-a-column-number-e-g-127-into-an-excel-column-e-g-aa)</summary>
/// <param name="columnNumber"></param>
/// <returns></returns>
Converts an int to an excel column name.
Code provided by Graham on Stack Overflow
Converts an int to an excel column name . Code provided by Graham on Stack Overflow
public static string IntToCol(int columnNumber) {
            string columnName = "";
            while (columnNumber > 0) {
                int modulo = (columnNumber - 1) % 26;
                columnName = Convert.ToChar('A' + modulo) + columnName;
                columnNumber = (columnNumber - modulo) / 26;
            }
            return columnName;
        }
public static string IntToCol ( int columnNumber ) { string columnName = " " ; while ( columnNumber > 0 ) { int modulo = ( columnNumber - 1 ) % 26 ; columnName = Convert . ToChar ( ' ' + modulo ) + columnName ; columnNumber = ( columnNumber - modulo ) / 26 ; } return columnName ; }
Converts an int to an excel column name.
Converts an int to an excel column name .
None
columnNumber
int
None