ArgumentOutOfRangeException after assign CellStyleName with modifed Interior.Gradient

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

1 Reply

DB Dilli Babu Nandha Gopal Syncfusion Team May 13, 2015 09:28 AM UTC

Hi Stephan,

We were able to reproduce the problem and have logged defect report regarding this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let me know if you have any questions.

Regards,
Dilli babu.

Loader.
Up arrow icon