简体   繁体   English

如何为“ Aspose Cells”中的单元格分配自定义颜色?

[英]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: 在旧版(Excel Interop)代码中,可以这样做来为单元格分配自定义颜色:

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

Using Aspose Cells, I'm trying to find the corresponding way to do it. 使用Aspose Cells,我正在尝试找到相应的方法。 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' " ...无法编译,告诉我,“ 无法将类型'int'隐式转换为'System.Drawing.Color'

So how can I assign a custom color in Aspose Cells? 那么如何在Aspose Cells中分配自定义颜色?

Please check the reply and sample code in your Aspose.Cells forum thread . 请在Aspose.Cells论坛主题中检查答复和示例代码。

Note: I am working as Developer Evangelist at Aspose 注意: 我在Aspose担任开发人员布道者

It seems as if the translation is unnecessary; 好像翻译是不必要的; this compiles: 编译:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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