Apply Format to entire column in Excel worksheet not working in .NET

I am using the following - in an attempt to set format for an entire column - but it is still coming in at arial 10...

Workbook workbook = new Workbook();

Worksheet sheet = workbook.Worksheets[0];

Aspose.Cells.Style style1;

StyleFlag flag1;

style1 = workbook.Styles[workbook.Styles.Add()];

style1.Font.IsBold = false;

style1.Font.Name = "Verdana";

style1.Font.Size = 8;

flag1 = new StyleFlag();

//flag1.NumberFormat = true;

//Apply style to the first column.

sheet.Cells.ApplyColumnStyle(0, style1, flag1);

ImportFromDataReader(sheet);

workbook.Save(this.Response, "SUMFunction.xls", ContentDisposition.Attachment, new XlsSaveOptions());


Hi Travis,

Thanks for identifying the problem and providing us the sample code to test the scenario. I am able to log the issue with an id CELLSNET-22343.

We will look into the issue in detail and update you soon.

Regards,

Hi,

Please ignore Masrat’s post. It is not an issue rather you have missed a line of code, see the updated part of code:

style1 = workbook.Styles[workbook.Styles.Add()];
style1.Font.IsBold = false;
style1.Font.Name = “Verdana”;
style1.Font.Size = 8;
flag1 = new StyleFlag();
flag1.Font = true;
//Apply style to the first column.
sheet.Cells.ApplyColumnStyle(0, style1, flag1);


Note: You need to make the corresponding Style attribute “ON” for StyleFlag object too.

Thank you.