This project has moved. For the latest updates, please go here.

Column Letter / Column Address

Mar 28, 2011 at 2:31 PM

Anyone know how to get the full address of an entire column given only a column index? Eg. ColumnIndex = 1, so looking for the full address of that column which is "A:A".  According to the documentation, there is a private GetColumnLetter method, but obviously that's inaccessible.  Is there another method that would do this?

Thanks!

 

Coordinator
Mar 28, 2011 at 6:27 PM

Hi,

You can use the MaxRows constant of the ExcelPackage class...

        /// <summary>
        /// Maximum number of columns in a worksheet (16384). 
        /// </summary>
        public const int MaxColumns = 16384;
        /// <summary>
        /// Maximum number of rows in a worksheet (1048576). 
        /// </summary>
        public const int MaxRows = 1048576;


Something like...
ws.Cells[1,1,ExcelPackage.MaxRows,1]