简体   繁体   中英

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?

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

Note: I am working as Developer Evangelist at Aspose

It seems as if the translation is unnecessary; this compiles:

styleContractRow2.ForegroundColor = Color.FromArgb(202, 134, 250);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM