We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Help with drawing a flipped line (Java)

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.
Hi Shaun,

I have observed the requirements shared by you and like to share that at present the support for rotation of line in terms of float value is avalalble. The following sample code will help you in generating the desired line.

public static void addLine()throws Exception
//Instantiate PrseetationEx class that represents the PPTX
PresentationEx pres = new PresentationEx();

//Get the first slide
SlideEx sld = pres.getSlides().get_Item(0);

//Add autoshape of rectangle type
int idx = sld.getShapes().addAutoShape(ShapeTypeEx.Line, 242, 112, 199, 211);
ShapeEx shp = sld.getShapes().get_Item(idx);
//Set the fill color of the rectangle shape
//set the color of the line of rectangle

//Write the PPTX file to disk
pres.write("d:\\Aspose Data\\RectShpLn2.pptx");


I like to share that at present the Horizontal or vertical flip options is unavailable in Aspose.Slides. I have created an issue with ID SLIDESJAVA-33796 in our issue tracking system to provide the rotation options as mentioned. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

Many Thanks,


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().setWidth (5);

            IShapeFrame oldFrame = Line1.getFrame();
            //Adding a new shape by copying existing
            IAutoShape Line2 = (IAutoShape) slide.getShapes().addClone(Line1);


            //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);

The issues you have found earlier (filed as SLIDESJAVA-33796) have been fixed in this update.