Free Support Forum - aspose.com

Modifying DefaultStyle

Hi,

I replaced 4.4.0.0 to latest version and I found modifing defaultstyle is not applied as general style.

please try following code and open output file.

**
Workbook workbook = new Workbook();
Style style = workbook.DefaultStyle;
style.Font.Name = "Tahoma";
style.Font.Size = 11;
style.VerticalAlignment = TextAlignmentType.Top;
workbook.DefaultStyle = style;
**

Menu->Format->Style->Style Dialogbox
Font "Arial 10"

Do I need to try another new way to set this property?
Thanks

Hi,

Do you use 4.4.3. Yes we checked and found the issue if we create a new workbook and modify the any default style. We will figure out the issue soon.

Thank you.

Hi,

Please try this fix.

If you want to change named style in Menu->Format->Style->Style Dialogbox,see following codes:

workbook.Open(@"F:\FileTemp\Book1.xls");
Style style = workbook.Styles["Normal"];
style.Font.Name = "Tahoma";
style.Font.Size = 11;
style.VerticalAlignment = TextAlignmentType.Top;

//if you want to apply the change to the cell style,please call style.Update,

//Or the defatult style will not be changed too.
style.Update();

Hi, Warren

This fix works fine. Thanks!