We have used version 3.0.3 and 3.0.5 of the Aspose Excel DLL - trying to resolve an issue with styles:
In our C# program, we define styles in a new workbook object, then save the workbook. Then, we open the workbook again in the same C# program, and try to make reference to a style already defined from the step above. The style is there (and if we open the Excel file in Excel after the first save of the workbook, and even after the second save, all of the styles still appear in the workbook using version 3.0.5), but we are not seeing it being applied on the second part of the code when we try to use it to format cells.
This is done in the beginning of the code when the workbook object is first created:
styleIndex = excel_target.Styles.Add() ;
styleCustom = excel_target.Styles[styleIndex] ;
styleCustom.Font.Name = "Arial" ;
styleCustom.Font.IsBold = false ;
styleCustom.Font.IsItalic = false ;
styleCustom.Font.Size = 7 ;
styleCustom.VerticalAlignment = TextAlignmentType.Center ;
styleCustom.HorizontalAlignment = TextAlignmentType.Left ;
styleCustom.IsTextWrapped = false ;
styleCustom.Name = "Normal7HLeft" ;
Then we save the workbook:
excel_target.Save(@"c:\\wip_workbooks\\result - " + lnFileNameEmplId + ".xls", FileFormatType.Default);
Then later in the code, we open the workbook:
excel_target.Open (@"c:\\wip_workbooks\\result - " + lnFileNameEmplId + ".xls");
Then try to assign a Style object:
Style styleNormal7HLeft = null; // defined the style variable
styleNormal7HLeft = excel_target.Styles["Normal7HLeft"];
This last line no longer seems to work, styleNormal7HLeft does not get assigned to the style from the workbook. This did work in version 3.0.3 (but what didn't work in 3.0.3 is when you save a file, then open it, they styles completely disappeared out of Excel!).
Thanks for your help!