We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to conditionally format cells/rows after adding them from DataTable?


I'm currently evaluating Aspose.Cells.

It was pretty straightforward to create a designerfile containing header, footer, etc and then fill the rest of the worksheet with data that i get from our Database (using sheet.Cells.ImportDataTable())

Now i want to conditionally format certain cells. Lets say I have the following colums: ProductID, Price, Retailprice. What i'm trying to do is things like make productID red if price<0.90*retailPrice, or highlight the whole row with a green background color if some other condition is met.

How would i do things like this? How can i loop over the rows in a sheet, and do something to cell A from that row depending on values of cell B and C of that row?



Well, you may use conditional formatting after you have imported the datatable to your worksheet. Aspose.Cells provides API to implement conditional formattings, please check the following topic how to use the feature: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/conditional-formatting.html

Thank you.