@@ -2,7 +2,8 @@ id: powerpoint-shapes
22name : ' Insert shape, line, and text box' 
33description : ' Inserts geometric shapes, lines, and text boxes to a slide.' 
44host : POWERPOINT 
5- api_set : PowerPointApi '1.4' 
5+ api_set :
6+     PowerPointApi : ' 1.4' 
67script :
78    content : | 
89        $("#create-hexagon").on("click", () => tryCatch(createHexagon)); 
@@ -18,14 +19,14 @@ script:
1819          // and adds a hexagon shape to the collection, while specifying its 
1920          // location and size. Then it names the shape. 
2021          await PowerPoint.run(async (context) => { 
21-             const shapes = context.presentation.slides.getItemAt(0).shapes; 
22-             const hexagon = shapes.addGeometricShape( PowerPoint.GeometricShapeType.hexagon,   
23-                 {  
24-                   left : 100, 
25-                   top: 100 , 
26-                   height : 150,  
27-                   width: 150  
28-                 } ); 
22+             const shapes: PowerPoint.ShapeCollection  = context.presentation.slides.getItemAt(0).shapes; 
23+             const shapeOptions:  PowerPoint.ShapeAddOptions = {  
24+               left: 100,  
25+               top : 100, 
26+               height: 150 , 
27+               width : 150 
28+             };  
29+             const hexagon: PowerPoint.Shape = shapes.addGeometricShape(PowerPoint.GeometricShapeType.hexagon, shapeOptions ); 
2930            hexagon.name = "Hexagon"; 
3031
3132            await context.sync(); 
@@ -36,8 +37,8 @@ script:
3637          // This function gets the collection of shapes on the first slide, 
3738          // gets the first shape in the collection, and resets its size. 
3839          await PowerPoint.run(async (context) => { 
39-             const shapes = context.presentation.slides.getItemAt(0).shapes; 
40-             const hexagon = shapes.getItemAt(0); 
40+             const shapes: PowerPoint.ShapeCollection  = context.presentation.slides.getItemAt(0).shapes; 
41+             const hexagon: PowerPoint.Shape  = shapes.getItemAt(0); 
4142            hexagon.height = 50; 
4243            hexagon.width = 50; 
4344
@@ -49,8 +50,8 @@ script:
4950          // This function gets the collection of shapes on the first slide, 
5051          // gets the first shape in the collection, and resets its location. 
5152          await PowerPoint.run(async (context) => { 
52-             const shapes = context.presentation.slides.getItemAt(0).shapes; 
53-             const hexagon = shapes.getItemAt(0); 
53+             const shapes: PowerPoint.ShapeCollection  = context.presentation.slides.getItemAt(0).shapes; 
54+             const hexagon: PowerPoint.Shape  = shapes.getItemAt(0); 
5455            hexagon.top = 50; 
5556            hexagon.left = 150; 
5657
@@ -63,11 +64,11 @@ script:
6364          // and adds a line to the collection, while specifying its 
6465          // start and end points. Then it names the shape. 
6566          await PowerPoint.run(async (context) => { 
66-             const shapes = context.presentation.slides.getItemAt(0).shapes; 
67+             const shapes: PowerPoint.ShapeCollection  = context.presentation.slides.getItemAt(0).shapes; 
6768
6869            // For a line, left and top are the coordinates of the start point, 
6970            // while height and width are the coordinates of the end point. 
70-             const line = shapes.addLine(PowerPoint.ConnectorType.straight,  
71+             const line: PowerPoint.Shape  = shapes.addLine(PowerPoint.ConnectorType.straight,  
7172                {  
7273                  left: 400,  
7374                  top: 200,  
@@ -85,8 +86,8 @@ script:
8586          // and adds a text box to the collection, while specifying its text, 
8687          // location, and size. Then it names the text box. 
8788          await PowerPoint.run(async (context) => { 
88-             const shapes = context.presentation.slides.getItemAt(0).shapes; 
89-             const textbox = shapes.addTextBox("Hello!",  
89+             const shapes: PowerPoint.ShapeCollection  = context.presentation.slides.getItemAt(0).shapes; 
90+             const textbox: PowerPoint.Shape  = shapes.addTextBox("Hello!",  
9091                {  
9192                  left: 100,  
9293                  top: 300,  
@@ -105,8 +106,8 @@ script:
105106          // location and size. Then it names the shape, sets its text and font 
106107          // color, and centers it inside the braces. 
107108          await PowerPoint.run(async (context) => { 
108-             const shapes = context.presentation.slides.getItemAt(0).shapes; 
109-             const braces = shapes.addGeometricShape(PowerPoint.GeometricShapeType.bracePair, { 
109+             const shapes: PowerPoint.ShapeCollection  = context.presentation.slides.getItemAt(0).shapes; 
110+             const braces: PowerPoint.Shape  = shapes.addGeometricShape(PowerPoint.GeometricShapeType.bracePair, { 
110111                left: 100, 
111112                top: 400, 
112113                height: 50, 
@@ -125,8 +126,8 @@ script:
125126          // This function gets the collection of shapes on the first slide, 
126127          // and then iterates through them, deleting each one. 
127128          await PowerPoint.run(async (context) => { 
128-             const slide = context.presentation.slides.getItemAt(0); 
129-             const shapes = slide.shapes; 
129+             const slide: PowerPoint.Slide  = context.presentation.slides.getItemAt(0); 
130+             const shapes: PowerPoint.ShapeCollection  = slide.shapes; 
130131
131132            // Load all the shapes in the collection without loading their properties. 
132133            shapes.load("items/$none"); 
0 commit comments