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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Conditional Formatting - Highlight Duplicates

Thread ID:





116130 Apr 9,2014 09:51 AM UTC Apr 10,2014 07:34 AM UTC ASP.NET Web Forms (Classic) 2
Tags: XlsIO
Andy Hewitt
Asked On April 9, 2014 09:51 AM UTC

In Excel 2007 I can create a conditional formatting rule to show up duplicates contained within a range.
For example:  Select column D, Click Conditional Formatting -> Highlight Cells Rules -> Duplicate Values...
How do I set up the same in code using the XlsIO component?  I'm having trouble figuring it out.
Unfortunately the XlsIO code generator tool does not seem to show this when I use it to look at a spreadsheet that has been set up with this conditional formatting.

Andy Hewitt
Replied On April 9, 2014 11:25 AM UTC

I have not been able to find a way to do it as described above but I have found a way to achieve the same.  Would still be interested to know if there is a direct solution that matches Excel's Duplicates conditioning via XlsIO if anyone knows?
For benefit of anyone else wishing to achieve this, here is my solution:
                IConditionalFormats condition = MeasureSheet.Range["D2:D2000"].ConditionalFormats; 
                IConditionalFormat noDuplicates = condition.AddCondition();
                noDuplicates.FormatType = ExcelCFType.Formula;
                noDuplicates.FirstFormula = "countif(D:D,INDIRECT(ADDRESS(ROW(), COLUMN())))>1";
                noDuplicates.BackColor = ExcelKnownColors.Red;
                noDuplicates.FontColor = ExcelKnownColors.White;

Prasanth M [Syncfusion]
Replied On April 10, 2014 07:34 AM UTC

Hi Andy,

Thanks for your update.

XlsIO does not have support to find duplicates in Excel file. You can use your workaround to achieve this. We have added it to our feature request list and it can be tracked through our Features Management System:

Please let us know if you need any clarification.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon