📜  c# 将 excel 列索引转换为字母 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:39.480000             🧑  作者: Mango

代码示例1
private string GetExcelColumnName(int columnNumber)
{
    int dividend = columnNumber;
    string columnName = String.Empty;
    int modulo;

    while (dividend > 0)
    {
        modulo = (dividend - 1) % 26;
        columnName = Convert.ToChar(65 + modulo).ToString() + columnName;
        dividend = (int)((dividend - modulo) / 26);
    } 

    return columnName;
}