使用 Aspose.Cells 处理形状或图表的三维格式
Contents
[
Hide
]
可能的使用场景
Aspose.Cells 提供 Shape.ThreeDFormat 属性,用于处理形状或图表的三维格式。其中包含了不同的子属性,可以根据需求设置以达到不同的效果。
以下截图显示了 Microsoft Excel 的界面,用于设置形状的三维格式。
使用 Aspose.Cells 处理形状或图表的三维格式
以下示例代码加载 源 Excel 文件 并访问第一个工作表中的第一个形状,设置 Shape.ThreeDFormat 的子属性,然后将工作簿保存在 输出 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(WorkingWithThreeDFormat.class) + "articles/"; | |
//Load excel file containing a shape | |
Workbook wb = new Workbook(dataDir + "WorkingWithThreeDFormat_in.xlsx"); | |
//Access first worksheet | |
Worksheet ws = wb.getWorksheets().get(0); | |
//Access first shape | |
Shape sh = ws.getShapes().get(0); | |
//Apply different three dimensional settings | |
ThreeDFormat n3df = sh.getThreeDFormat(); | |
n3df.setContourWidth(17); | |
n3df.setExtrusionHeight(32); | |
n3df.setTopBevelType(BevelType.HARD_EDGE); | |
n3df.setTopBevelWidth (30); | |
n3df.setTopBevelHeight(30); | |
//Save the output excel file in xlsx format | |
wb.save(dataDir + "WorkingWithThreeDFormat_out.xlsx"); |