How to add straight line shape non width or height in PowerPoint .ShapeCollection Api

Hosshan 1 Reputation point
2022-05-06T06:38:57.127+00:00

I'm using PowerPoint.ShapeCollection addLine function.
But I'm having trouble drawing parallel lines.

Because addLine's ShapeAddOptions width or height set 0 to recognized as having no value specified.

const newShape1 = shapes.addLine(PowerPoint.ConnectorType.straight, {  
            left: 100 + shapeWidth + lineWidth / 2,  
            top: 100 + shapeHeight / 2,  
            width: 1,  
            height: 0,  
          });  

https://learn.microsoft.com/en-us/javascript/api/powerpoint/powerpoint.shapecollection?view=powerpoint-js-preview#powerpoint-powerpoint-shapecollection-addgeometricshape-member

Microsoft 365 and Office | Development | Office JavaScript API
Microsoft 365 and Office | PowerPoint | For business | Windows
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.