How to Add Polyline Shape?

How to Add Polyline Shape ?

I cannot find AddPolyline Method on a shape object.

And also for information i am using Aspose.Slides for .NET version 15.1.0

Aspose Team,

We need some help ASAP. Since this is a critical functionality for our application.

Hi Prakash,


I have observed the requirement shared by you and like to share that in PowerPoint even there is provision to add Line shape. There is no provision to add poly line ( To me a poly line is a line with more than one vertices). In order to add a line, you can please visit this documentation link. You can achieve the essence of poly line by adding multiple lines (repeating the common edges in two lines) and then grouping them together in a shape. To find more about group shape, please visit this link.

Many Thanks,

not sure what a polyline is but if it is a continuous line of more than one segment that essentially looks like a line on a graph where the line is angled by the up or down angles, then you may want to try a series of lines that are rotated by the appropriate degree. I've done this when I needed a vertical line. just a thought.

Thanks Mudassir and rrk,


When i initially searched for a solution to draw poly line in this forum. I have found multiple posts mentioning about AddPolyline() method. I am not sure if it was available in earlier versions.

I was looking for a equivalent method for VBA Shapes.AddPolyline()

Hi Prakash,

The possible approach using Aspose.Slides is one that has been shared by me and also explained by RRK. If you ought to add such line you can refer to approach shared. There is no specific method available to add poly line.

Many Thanks,

Mudassir,


Based on your previous suggestion in this post. I have tried to draw a poly line with this below code

I was able to draw the poly line but one issue is i am not able to get the vertical angle between first line and second line.

check the image which shows the poly line with this below code http://gyazo.com/1f545ef01f4e487eec75d09ac4859ca5

Where in i would like my poly line to look like this http://gyazo.com/aee28a6e020762400f2591d5417c9d84 based on my coordinates.

//create a group shape
IGroupShape groupShape = slide.Shapes.AddGroupShape();
IAutoShape firstLine = groupShape.Shapes.AddAutoShape(ShapeType.Line,
areaMapDimensionsEntity.PptxSurfaceX,
areaMapDimensionsEntity.PptxSurfaceY,
Math.Abs(areaMapDimensionsEntity.PptxVtargetX - areaMapDimensionsEntity.PptxSurfaceX),
Math.Abs(areaMapDimensionsEntity.PptxVtargetY - areaMapDimensionsEntity.PptxSurfaceY));
firstLine.FillFormat.SolidFillColor.Color = Color.Black;
firstLine.LineFormat.Width = 1.25;

IAutoShape secondLine = groupShape.Shapes.AddAutoShape(ShapeType.Line,
groupShape.Shapes[0].X + groupShape.Shapes[0].Width, // adding X + Width to get the X axis for the second line
groupShape.Shapes[0].Y + groupShape.Shapes[0].Height,// adding Y + height to get the X axis for the second line
Math.Abs(areaMapDimensionsEntity.PptxVtargetX - areaMapDimensionsEntity.PptxBottomX),
Math.Abs(areaMapDimensionsEntity.PptxVtargetY - areaMapDimensionsEntity.PptxBottomY));
secondLine.LineFormat.EndArrowheadStyle = LineArrowheadStyle.Stealth;
secondLine.LineFormat.EndArrowheadWidth = LineArrowheadWidth.Narrow;
secondLine.LineFormat.EndArrowheadLength = LineArrowheadLength.Short;
secondLine.FillFormat.SolidFillColor.Color = Color.Black;
secondLine.LineFormat.Width = 1.25;

Let me know if you need any more information


Hi Prakash,

I have observed your requirement for calculating the angle between two poly lines that share a common point. Think of the common point between two lines as intersection points between them. There is no Aspose.Slides feature available for this. However, you can use Cartesian geometery here to calculate the angle between two lines by using common point between two points as intersection point. I suggest you to please visit article 1, article 2 and article 3 for developing an approach on your end. I hope this will be helpful.

Many Thanks,