读取形状的发光效果的颜色
Contents
[
Hide
]
可能的使用场景
如果您想要阅读任何形状的发光效果的颜色,请使用Shape.Glow.Color属性。这将帮助您找到与形状的发光效果的颜色相关的各种属性。
读取形状发光效果的颜色
请查看以下示例代码及其源Excel文件和控制台输出,供您参考。以下屏幕截图显示了在Microsoft Excel中查看源Excel文件时形状的发光效果。
读取形状发光效果颜色的C#代码
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
控制台输出
以下是在提供的源Excel文件上执行上述示例代码时的控制台输出。
Color: Color [A=222, R=255, G=0, B=0]
ColorIndex: 16711672
IsShapeColor: True
Transparency: 0.13
Type: RGB