for Push.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KssSmaPlaLib.IO.Excel
|
||||
{
|
||||
public static class ExcelColumnHelperUxer
|
||||
{
|
||||
public static string GetExcelColumnLetter(int columnNumber)
|
||||
{
|
||||
if (columnNumber < 1)
|
||||
throw new ArgumentOutOfRangeException(nameof(columnNumber), "Column number must be >= 1");
|
||||
|
||||
string columnLetter = string.Empty;
|
||||
while (columnNumber > 0)
|
||||
{
|
||||
columnNumber--; // Adjust for 0-indexed calculation
|
||||
columnLetter = (char)('A' + (columnNumber % 26)) + columnLetter;
|
||||
columnNumber /= 26;
|
||||
}
|
||||
return columnLetter;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user