We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

ArgumentOutOfRangeException after assign CellStyleName with modifed Interior.Gradient

Thread ID:

Created:

Updated:

Platform:

Replies:

119119 May 12,2015 08:45 AM May 13,2015 05:28 AM Windows Forms 1
loading
Tags: XlsIO
stephan weyer
Asked On May 12, 2015 08:45 AM

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

Dilli Babu Nandha Gopal [Syncfusion]
Replied On May 13, 2015 05:28 AM

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.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;