Change Adjustment Values of the Shape
Aspose.Cells provides Shape.getGeometry().getShapeAdjustValues() property to make changes to the adjustment points with shapes. In the Microsoft Excel UI, adjustments display as yellow diamond nodes. For example:
- Rounded Rectangle has an adjustment to change the arc
- Triangle has an adjustment to change the location of the point
- A trapezoid has an adjustment to change the width of the top
- Arrows have two adjustments to change the shape of the head and tail
This article will explain the use of Shape.getGeometry().getShapeAdjustValues() property to change the adjustment value of the different shapes.
Change Adjustment Values of the Shape
The following sample code accesses first three shapes of the first worksheet in the source excel file and then changes the adjustment values of the shapes. Below screenshots show how the shapes look before changing adjustment values and then after changing adjustment values.
Drawing Shapes Before Changing Adjustment Values
Drawing Shapes After Changing Adjustment Values
// 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"); |