Search code examples
excel-interopasposeaspose-cellsargbcolortransform

How can I assign a custom color to a cell in Aspose Cells?


In the legacy (Excel Interop) code, this can be done to assign a custom color to a cell:

contractCell.Interior.Color = ColorTranslator.ToOle(Color.FromArgb(202, 134, 250));

Using Aspose Cells, I'm trying to find the corresponding way to do it. This code:

styleContractRow2.ForegroundColor = ColorTranslator.ToOle(Color.FromArgb(202, 134, 250));
styleContractRow2.Pattern = BackgroundType.Solid;

...does not compile, telling me, "Cannot implicitly convert type 'int' to 'System.Drawing.Color'"

So how can I assign a custom color in Aspose Cells?


Solution

  • Please check the reply and sample code in your Aspose.Cells forum thread.

    Note: I am working as Developer Evangelist at Aspose