读取形状发光效果的颜色

可能的使用场景

如果你想读取任何形状发光效果的颜色,那么请使用形状.发光.颜色财产。它将帮助您找到与形状发光效果颜色相关的各种属性。

读取形状发光效果的颜色

请看下面的示例代码及其源文件和控制台输出供您参考。以下屏幕截图显示了在 Microsoft Excel 中查看时源 Excel 文件内形状的发光效果。

待办事项:图片_替代_文本

C# 读取形状发光效果颜色的代码

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Read the source excel file
Workbook book = new Workbook(dataDir + "sourceGlowEffectColor.xlsx");
// Access first worksheet
Worksheet sheet = book.Worksheets[0];
// Access the shape
Shape shape = sheet.Shapes[0];
// Read the glow effect color and its various properties
GlowEffect effect = shape.Glow;
CellsColor color = effect.Color;
Console.WriteLine("Color: " + color.Color);
Console.WriteLine("ColorIndex: " + color.ColorIndex);
Console.WriteLine("IsShapeColor: " + color.IsShapeColor);
Console.WriteLine("Transparency: " + color.Transparency);
Console.WriteLine("Type: " + color.Type);

控制台输出

这是使用提供的执行时上述示例代码的控制台输出源文件.

Color: Color [A=222, R=255, G=0, B=0]ColorIndex: 16711672

IsShapeColor: True

Transparency: 0.13

Type: RGB