使用形状或图表的阴影效果
Contents
[
Hide
]
可能的使用场景
Aspose.Cells提供Shape.ShadowEffect 属性,用于处理形状或图表的阴影效果。它包含以下子属性,您可以设置这些子属性以根据您的要求实现不同的结果。
- ShadowEffect.Angle
- ShadowEffect.Blur
- ShadowEffect.Color
- ShadowEffect.Distance
- ShadowEffect.PresetType
- ShadowEffect.Size
- ShadowEffect.Transparency
以下屏幕截图显示了Microsoft Excel界面,用于设置形状的阴影效果。
使用 Aspose.Cells 处理形状或图表的阴影效果
以下示例代码加载 源 Excel 文件 并访问第一个工作表中的第一个形状,设置 Shape.ShadowEffect 的子属性,然后将工作簿保存在 输出 Excel 文件中。
示例代码
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-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getSharedDataDir(WorkingWithShadowEffect.class) + "articles/"; | |
// Loads the workbook which contains hidden external links | |
Workbook wb = new Workbook(dataDir + "WorkingWithShadowEffect_in.xlsx"); | |
// Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
// Access first shape | |
Shape sh = ws.getShapes().get(0); | |
// Set the shadow effect of the shape | |
// Set its Angle, Blur, Distance and Transparency properties | |
ShadowEffect se = sh.getShadowEffect(); | |
se.setAngle(150); | |
se.setBlur(4); | |
se.setDistance(45); | |
se.setTransparency(0.3); | |
// Save the workbook in xlsx format | |
wb.save(dataDir + "WorkingWithShadowEffect_out.xlsx"); |