Hello together,
I need to set a gradient in cells. So i have to set the property "Interior" like i do in my sample
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2010;
IWorkbook workbook = application.Workbooks.Create(2);
IWorksheet sheet = workbook.Worksheets[0];
IStyle style = workbook.Styles.Add("style1");
style.BeginUpdate();
style.FillPattern = ExcelPattern.Gradient;
style.Interior.Gradient.GradientStyle = ExcelGradientStyle.Vertical;
style.Interior.Gradient.BackColor = Color.Black;
style.Interior.Gradient.ForeColor = Color.Beige;
for (int i = 1; i < 2000; i++)
{
IRange cell = sheet.Range[string.Format("A{0}", i)];
cell.CellStyleName = "style1";
}
style.EndUpdate();
workbook.SaveAs(@"c:\temp\test.xlsx");
workbook.Close();
excelEngine.Dispose();
This code ends in ArgumentOutOfRangeException (in assignment cell.CellStyleName = "style1").
stacktrace:
bei Syncfusion.XlsIO.Implementation.Collections.ExtendedFormatsCollection.get_Item(Int32 index)
bei Syncfusion.XlsIO.Implementation.RangeImpl.SetXFormatIndex(Int32 index)
bei Syncfusion.XlsIO.Implementation.RangeImpl.set_ExtendedFormatIndex(UInt16 value)
bei Syncfusion.XlsIO.Implementation.RangeImpl.ChangeStyleName(String strNewName)
bei Syncfusion.XlsIO.Implementation.RangeImpl.set_CellStyleName(String value)
bei Syncfusion.B002074.Form1.button1_Click(Object sender, EventArgs e) in d:\Test\Syncfusion.B002074\Syncfusion.B002074\Form1.cs:Zeile 61.
Only the assignments to property "Interior" seems to fail. I can modify all "direct" properties in style without any errors.
What can i do?
Thanks you for help
Stephan