Can you help me with the code required to draw a line like the one in the attached file.
In PowerPoint itself, this line requires a horizontal flip but I don’t see a method to set that in Aspose.Slides.
Can you help me with the code required to draw a line like the one in the attached file.
public static void addLine()throws Exception{//Instantiate PrseetationEx class that represents the PPTXPresentationEx pres = new PresentationEx();//Get the first slideSlideEx sld = pres.getSlides().get_Item(0);//Add autoshape of rectangle typeint idx = sld.getShapes().addAutoShape(ShapeTypeEx.Line, 242, 112, 199, 211);ShapeEx shp = sld.getShapes().get_Item(idx);shp.setRotation(90);//Set the fill color of the rectangle shapeshp.getFillFormat().setFillType(FillTypeEx.Solid);shp.getFillFormat().getSolidFillColor().setColor(Color.WHITE);//set the color of the line of rectangleshp.getLineFormat().getFillFormat().setFillType(FillTypeEx.Solid);shp.getLineFormat().getFillFormat().getSolidFillColor().setColor(Color.BLUE);//Write the PPTX file to diskpres.write("d:\\Aspose Data\\RectShpLn2.pptx");}
Using latest Aspose.Slides for Java 20.6, you can consider using the following example to create a flipped line on your end.
public static void TestLineFlip()
{
Presentation TestPres = new Presentation();
ISlide slide = TestPres.getSlides().get_Item(0);
IAutoShape Line1 = slide.getShapes().addAutoShape(ShapeType.Line, 100f, 100f, 400f, 400f);
Line1.getLineFormat().setEndArrowheadLength(LineArrowheadLength.Long);
Line1.getLineFormat().setEndArrowheadStyle(LineArrowheadStyle.Triangle);
Line1.getLineFormat().getFillFormat().setFillType(FillType.Solid);
Line1.getLineFormat().getFillFormat().getSolidFillColor().setColor(java.awt.Color.GRAY);
Line1.getLineFormat().setWidth (5);
IShapeFrame oldFrame = Line1.getFrame();
//Adding a new shape by copying existing
IAutoShape Line2 = (IAutoShape) slide.getShapes().addClone(Line1);
Line2.getLineFormat().getFillFormat().getSolidFillColor().setColor(java.awt.Color.RED);
//Following code snippet will flip the shape horizontally
Line2.setFrame (new ShapeFrame(oldFrame.getX(), oldFrame.getY(), oldFrame.getWidth(), oldFrame.getHeight(), NullableBool.True, oldFrame.getFlipV(), oldFrame.getRotation()));
TestPres.save("C:\\Aspose Data\\Line.pptx",SaveFormat.Pptx);
}