We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem with setting Column.Style.Custom


I am using Aspose.Cells with the following code:

worksheet.Cells.Columns[colIdx].Style.Custom = "dd/mm/yyyy";

The contents of the column remain in the default format.

I have also tried creating a style and applying it, like this:

Style style = worksheet.Workbook.Styles[worksheet.Workbook.Styles.Add()];

style.Custom = "dd/mm/yyyy";

StyleFlag flag = new StyleFlag();

worksheet.Cells.ApplyColumnStyle(colIdx, style, flag);

That doesn't work either, nor does worksheet.Cells.Columns[colIdx].ApplyStyle(...).

Thanks for your help.

I had a similar problem last week, check <A href="https://forum.aspose.com/t/90824


Kindly try the latest version 4.4.3. http://www.aspose.com/community/files/51/file-format-components/aspose.cells/entry121851.aspx

I have tested it using the following sample code and it works fine.

Workbook wb = new Workbook();
Worksheet sheet = wb.Worksheets[0];
Style style;
StyleFlag flag;

style = wb.Styles[wb.Styles.Add()];
style.Custom = "dd/mm/yyyy";
flag = new StyleFlag();
flag.NumberFormat = true;

sheet.Cells.ApplyColumnStyle(0,style, flag);


Thank you.