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

Free Support Forum - aspose.com

How to flip line horizontally or vertically (C# .NET)

Hi, is there any way to flip a shape vertically or horizontally?


Hello Dear,

Flipping shapes vertically and horizontally is supported in Aspose.Slides for .NET. The following code snippet can be used for flipping the shapes. However, at the moment the property seems to be read only. An issue with ID 24329 has been created in our issue tracking system to further investigate and resolve the issue. This thread has also been linked with the issue so that you may be automatically notified once the issue is resolved.


We are sorry for your inconvenience,

Hi, is it possible to draw a line like the one in the example below.



Hello Dear,

Please use the code snippet shared below for adding the requested line shape. The last part of code snippet shows how to flip the shapes. Actually, FlipH and FlipV property are read only and you need to create new FrameEx and set the FlipH and FlipV values in newly generate frame. Please follow this link to documentation to have some more insight about the shapes.

PresentationEx TestPres = new PresentationEx();

SlideEx TestSlide = TestPres.Slides[0];

//int iid = TestSlide.Shapes.AddAutoShape(ShapeTypeEx.l, 100, 100, 400, 400);

int iid = TestSlide.Shapes.AddAutoShape(ShapeTypeEx.Line, 100, 100, 400, 400);

AutoShapeEx line = (AutoShapeEx)TestSlide.Shapes[iid];

ShapeEx sline = TestSlide.Shapes[iid];

// line.LineFormat.BeginArrowheadLength = LineArrowheadLengthEx.Long;

// line.LineFormat.BeginArrowheadLength = LineArrowheadLengthEx.Short;

// line.LineFormat.BeginArrowheadStyle = LineArrowheadStyleEx.Oval;

line.LineFormat.EndArrowheadLength = LineArrowheadLengthEx.Long;

line.LineFormat.EndArrowheadStyle = LineArrowheadStyleEx.Triangle;

line.LineFormat.FillFormat.FillType = FillTypeEx.Solid;

line.LineFormat.FillFormat.SolidFillColor.Color = Color.Black;

line.LineFormat.Width = 5;

//Following code snippet will flip the shape horizontally

ShapeFrameEx oldFrame = sline.Frame;

sline.Frame = new ShapeFrameEx(oldFrame.X, oldFrame.Y, oldFrame.Width, oldFrame.Height, true, oldFrame.FlipV, oldFrame.Rotation);

bool status = sline.Frame.FlipH;

TestPres.Write(pa + "ShapeEx.pptx");

Thanks and Regards,


The example code provided earlier was workable with older API versions. For latest Aspose.Slides for .NET 20.6, please try following sample on your end.

	public static void TestLineFlip()
		String path=@"C:\Aspose Data\";

		Presentation TestPres = new Presentation();

		ISlide slide = TestPres.Slides[0];

		var Line1 = slide.Shapes.AddAutoShape(ShapeType.Line, 100f, 100f, 400f, 400f);

		Line1.LineFormat.EndArrowheadLength = LineArrowheadLength.Long;

		Line1.LineFormat.EndArrowheadStyle = LineArrowheadStyle.Triangle;

		Line1.LineFormat.FillFormat.FillType = FillType.Solid;

		Line1.LineFormat.FillFormat.SolidFillColor.Color = Color.Gray;

		Line1.LineFormat.Width = 5;

		IShapeFrame oldFrame = Line1.Frame;
		var FlipHValue = Line1.Frame.FlipH;

		var Line2 = slide.Shapes.AddClone(Line1);

		Line2.LineFormat.FillFormat.SolidFillColor.Color = Color.Red;

		//Following code snippet will flip the shape horizontally
		Line2.Frame = new ShapeFrame(oldFrame.X, oldFrame.Y, oldFrame.Width, oldFrame.Height, NullableBool.True, oldFrame.FlipV, oldFrame.Rotation);

		var FlipHValue2 = Line1.Frame.FlipH;

		TestPres.Save("C:\\Aspose Data\\Line.pptx",SaveFormat.Pptx);

Line.zip (22.2 KB)