|
| 1 | +package com.aspose.slides.examples.shapes; |
| 2 | + |
| 3 | +import com.aspose.slides.*; |
| 4 | +import com.aspose.slides.examples.RunExamples; |
| 5 | + |
| 6 | +import java.io.IOException; |
| 7 | + |
| 8 | +public class AdjustValueTypeExample |
| 9 | +{ |
| 10 | + public static void main(String[] args) throws IOException |
| 11 | + { |
| 12 | + //Path for presentation |
| 13 | + String presentationName = RunExamples.getDataDir_Shapes() + "PresetGeometry.pptx"; |
| 14 | + |
| 15 | + // Path to output document |
| 16 | + String outFilePath = RunExamples.getOutPath() + "PresetGeometry_out.pptx"; |
| 17 | + |
| 18 | + //ExStart:AdjustValueTypeExample |
| 19 | + Presentation pres = new Presentation(presentationName); |
| 20 | + try { |
| 21 | + IAutoShape shape = (IAutoShape)pres.getSlides().get_Item(0).getShapes().get_Item(0); |
| 22 | + |
| 23 | + // Show all adjustment point and its types for a RoundRectangle |
| 24 | + System.out.println("Adjustment types for a Rectangle:"); |
| 25 | + for (int i=0 ; i < shape.getAdjustments().size(); i++) |
| 26 | + { |
| 27 | + System.out.println("\tType for point " + i + " is \"" + ShapeAdjustmentType.getName(ShapeAdjustmentType.class, shape.getAdjustments().get_Item(i).getType()) + "\""); |
| 28 | + } |
| 29 | + // Change value of an adjustment point |
| 30 | + if (shape.getAdjustments().get_Item(0).getType() == ShapeAdjustmentType.CornerSize) |
| 31 | + { |
| 32 | + shape.getAdjustments().get_Item(0).setAngleValue(shape.getAdjustments().get_Item(0).getAngleValue() * 2); |
| 33 | + } |
| 34 | + |
| 35 | + // Show all adjustment point and its types for an RightArrow |
| 36 | + IAutoShape shape1 = (IAutoShape)pres.getSlides().get_Item(0).getShapes().get_Item(1); |
| 37 | + System.out.println("Adjustment types for an Arrow:"); |
| 38 | + for (int i = 0; i < shape1.getAdjustments().size(); i++) |
| 39 | + { |
| 40 | + System.out.println("\tType for point " + i + " is \"" + ShapeAdjustmentType.getName(ShapeAdjustmentType.class, shape1.getAdjustments().get_Item(i).getType()) + "\""); |
| 41 | + } |
| 42 | + // Change value of adjustment points |
| 43 | + if (shape1.getAdjustments().get_Item(0).getType() == ShapeAdjustmentType.ArrowTailThickness) |
| 44 | + { |
| 45 | + shape1.getAdjustments().get_Item(0).setAngleValue(shape1.getAdjustments().get_Item(0).getAngleValue() / 3); |
| 46 | + } |
| 47 | + if (shape1.getAdjustments().get_Item(1).getType() == ShapeAdjustmentType.ArrowheadLength) |
| 48 | + { |
| 49 | + shape1.getAdjustments().get_Item(1).setAngleValue(shape1.getAdjustments().get_Item(1).getAngleValue() / 2); |
| 50 | + } |
| 51 | + |
| 52 | + // Save the presentation |
| 53 | + pres.save(outFilePath, SaveFormat.Pptx); |
| 54 | + |
| 55 | + } finally { |
| 56 | + if (pres != null) pres.dispose(); |
| 57 | + } |
| 58 | + //ExEnd:AdjustValueTypeExample |
| 59 | + } |
| 60 | +} |
0 commit comments