更改形状的调整值

改变形状的调整值

以下示例代码访问源Excel文件中第一个工作表的前三个形状,然后更改形状的调整值。下面的屏幕截图显示在更改调整值之前形状的外观以及在更改调整值之后的外观。

更改调整值之前的绘图形状

todo:image_alt_text

更改调整值之后的绘图形状

todo:image_alt_text

// 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.getDataDir(ChangeAdjustmentValuesOfShape.class);
// Create workbook object from source excel file
Workbook workbook = new Workbook(dataDir + "source.xlsx");
// Access first worksheet
Worksheet worksheet = workbook.getWorksheets().get(0);
// Access first three shapes of the worksheet
Shape shape1 = worksheet.getShapes().get(0);
Shape shape2 = worksheet.getShapes().get(1);
Shape shape3 = worksheet.getShapes().get(2);
// Change the adjustment values of the shapes
shape1.getGeometry().getShapeAdjustValues().get(0).setValue(0.5d);
shape2.getGeometry().getShapeAdjustValues().get(0).setValue(0.8d);
shape3.getGeometry().getShapeAdjustValues().get(0).setValue(0.5d);
// Save the workbook
workbook.save(dataDir + "output.xlsx");