0

Is it possible to create a conditional format or something like that where the format is depending on the value of the cell?

For example when there is "#000000" as cell value, the background color of the cell should be black.

It is possible to have a condition on the cell value but I did not find any example where the format is dynamic. And it is no Option to create a format for each possible hex-color =)

Dominik Kirschenhofer
  • 1,205
  • 1
  • 13
  • 27

1 Answers1

1

Yes it is possible to add such a conditional formatting dynamically using Aspose.Cells. Please add your desired conditional formatting using the Worksheet.ConditionalFormattings collection. It will be better if you create your conditional formatting using Microsoft Excel and then load your workbook using Aspose.Cells and observe the properties of your conditional formatting object by exploring Worksheet.ConditionalFormattings collection and then create the same conditional formatting object through code. If you find any difficulty, then please feel free to post in Aspose.Cells forum on Aspose Website.

Please also see this article for your help in working with conditional formatting.

http://www.aspose.com/docs/display/cellsnet/Conditional+Formatting

Note: I am working as Developer Evangelist at Aspose

shakeel
  • 1,717
  • 10
  • 14
  • Hi! Maybe i misunderstood the examples but i could not find one where the values of the Format are depending on the cell value... "cond.Style.BackgroundColor = Color.Pink". I would need something like "cond.Style.BackgroundColor = cell.Value" But i could not even get that running in EXCEL =/ – Dominik Kirschenhofer Nov 23 '15 at 11:02
  • Thanks for your comment. Please post your issue in Aspose.Cells forum along with your sample excel file containing your conditional formatting which you can create manually using Microsoft Excel and then we will look into it and provide you a sample code to achieve the same thing programmatically using Aspose.Cells API. Thanks for your understanding and cooperation. – shakeel Nov 23 '15 at 14:49