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.

Add ConditionalFormats

Thread ID:

Created:

Updated:

Platform:

Replies:

92386 Jan 12,2010 02:55 AM Jan 12,2010 05:36 AM ASP.NET Web Forms (Classic) 1
loading
Tags: XlsIO
Marcia van de Leur
Asked On January 12, 2010 02:55 AM

Hello,

I try to add conditional formats to a cell. But when I run the code sheet[x,y].ConditionalFormats.AddCondition() I get the ArgumentOutOfRangeError 'Too many conditional formats'.

I tried to add the conditional formats in the excel template directly, but only 3 conditional formats remain in my excel template, the 4th one has disappeared in the excel file (while it is in the template)

Lokesh R [Syncfusion]
Replied On January 12, 2010 05:36 AM

Hi Marcia,

Thank you for your interest on Syncfusion products.


Excel allows the addition of a maximum of three conditions only, for the same cell in the Biff8 format(Excel 2003 format).

XlsIO allows to create conditional formats using IConditionFormats, and various conditions can be set using its properties. It also provides support for applying more than three conditional formats in the same cell, in the .xlsx (Excel 2007)format,which is a constraint in Excel2003 format as i have mentioned earlier(allows only 3 conditions to be applied).

Could you please make the below changes in your code.so,that it would work as you expected.


IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2007;
IWorkbook workbook = application.Workbooks.Create(1);

and save the file in XLSX format as below:

workbook.SaveAs("Sample.xlsx");
workbook.Close();
excelEngine.Dispose();


For more information about conditionalformatting,please visit

http://www.syncfusion.com:91/products/xlsio/backoffice/Articles/conditional_formatting.aspx.


please let me know if this helps.

Regards,
Lokesh

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.

;