Conditional Formatting with Smart Markers of Aspose.Cells

Hi am using template file. I want to set background of cell if value does not match.
I am filling the data using smart markers. I have added conditional formatting for cell value.
which is not working for smart marker. can you help me

@Shitaldave,

Could you please create a sample console application (source code without compilation errors), zip the project and post us with resource files to reproduce the issue, we will check it soon.

PS. please create data source for the Smart Markers in code to remove any interdependencies of external source.

ConsoleApp1.zip (6.4 MB)
Please find the attached one

@Shitaldave,

Thanks for the template file and sample.

Please change the line of code:

var dt = new DataTable();

to:

var dt = new DataTable("dt");

You should set the same DataTable’s name as you used when defining Smart Markers in your template Excel file.

Let us know if you still find any issue.

in my original code have set the tablename = “dt”. which am referring in excel .
Question is in excel what is the format i need to add for conditional formatting

@Shitaldave,

I tested your sample (after updating the mentioned line of code) with your template Excel file using latest version of Aspose.Cells for .NET and it works fine. See the attached output file for your reference.
files1.zip (7.0 KB)

The D column cells has conditional formatting applied properly.

if you just update the value of D same as B for 1st row, the color will be removed from all the other rows to values of D Column. it means it is not applied row by row.
image.png (2.9 KB).
i want same behavior for all the rows. for ex. B2 <> D2 then highlight D2 red
ifB3 == D3 then do not highlight D3.
So here D2 should be red D3 should have no color set

@Shitaldave,

We will look into it and get back to you soon.

@Shitaldave
Please checkBook1.zip (6.8 KB)
Please change absolute refer(=$B$2 <>$D$2) as relative refer(=B2 <>D2) in the formulas of conditional formatting.
If the formula is absolute refer, it will not automatically change in different cell. It’s behavior of MS Excel.

@Shitaldave,

Moreover, I now tested with the updated template Excel file (as shared by @simon.zhao) and it works fine and as per your expectation. Please find attached the output Excel file for your reference.
Testt1.zip (6.8 KB)

Thanks the solution works for me.

@Shitaldave,

Good to know that the suggested solution works for your needs. Feel free to write us back if you have further queries or comments.