Format columns

Hi,

I´m trying to format all cells of a column to display the value with two numbers (example: 01, 03, 05…). When I type “01” it´s shows “1”… Any example???


Thank you in advance :wink:

Hi,


Thank you for contacting Aspose support.

Please use the custom pattern as “00” to show the numeric values to 2 digits. Please also check the following piece of code that applies the above mentioned format to the first column of the worksheet.

C#

var book = new Workbook();
var cells = book.Worksheets[0].Cells;
var style = book.CreateStyle();
style.Custom = “00”;
cells.Columns[0].ApplyStyle(style, new StyleFlag() { NumberFormat = true });
cells[“A1”].PutValue(1);
book.Save(dir + “output.xlsx”);