I want to add a style to the workbook and then set it to a cell's style property. The style depends on a number of parameters at runtime so we need to set it like this.
Do you have any sample code for this?
thanks
scott
StylesCollection sc = wb.Styles;
CellStyle cs;
cs = sc.Add("WorksheetTitle");
cs.WrapText = true;
cs.VerticalAlignment = VerticalAlignType.Top;
cs.HorizontalAlignment = HorizontalAlignType.Left;
cs.Font.FontName = "Trebuchet MS";
cs.Font.Size = 18;
cs.Font.IsItalic = true;
cs.Font.IsBold = true;
....
worksheet.Range[1, 1].Style = styles["WorksheetTitle"];
GIVES EXCEPTION
Style name cannot be found. Name: WorksheetTitle
Parameter name: value
at Spire.Xls.Core.Spreadsheet.Collections.XlsStylesCollection.get_Item(String
name)
at Spire.Xls.Collections.StylesCollection.get_Item(String name)
at CashFlowXmlBuilder.WorkbookBuilderSpire.addWorkSheet(DataTable table, Work
...