Skip to content

Instantly share code, notes, and snippets.

@ononder
Created August 10, 2021 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ononder/3f8986126d07a3f81d7fc36af80dbe72 to your computer and use it in GitHub Desktop.
Save ononder/3f8986126d07a3f81d7fc36af80dbe72 to your computer and use it in GitHub Desktop.
Adds a simple shape with some properties
name: Simple Add New Shape
description: Adds a simple shape with some properties
host: POWERPOINT
api_set: {}
script:
content: |
$("#run").click(run);
async function run() {
await PowerPoint.run(async function(context) {
var newshape = context.presentation.slides.getItemAt(0).shapes.addGeometricShape(PowerPoint.GeometricShapeType.roundRectangle);
newshape.left = 100;
newshape.top = 100;
newshape.width = 200;
newshape.height = 300;
newshape.lineFormat.weight = 22;
newshape.lineFormat.color = "red";
newshape.lineFormat.transparency = 0.3;
newshape.lineFormat.dashStyle = PowerPoint.ShapeLineDashStyle.longDashDotDot;
newshape.lineFormat.style = PowerPoint.ShapeLineStyle.thinThick;
newshape.fill.foregroundColor = "#FFFF00";
newshape.fill.transparency = 0.8;
await context.sync();
});
}
language: typescript
template:
content: |-
<button id="run" class="ms-Button">
<span class="ms-Button-label">Run</span>
</button>
language: html
style:
content: |-
section.samples {
margin-top: 20px;
}
section.samples .ms-Button, section.setup .ms-Button {
display: block;
margin-bottom: 5px;
margin-left: 20px;
min-width: 80px;
}
language: css
libraries: |
https://unpkg.com/@microsoft/office-js@1.1.71-custom.37/dist/office.js
@types/office-js
office-ui-fabric-js@1.4.0/dist/css/fabric.min.css
office-ui-fabric-js@1.4.0/dist/css/fabric.components.min.css
core-js@2.4.1/client/core.min.js
@types/core-js
jquery@3.1.1
@types/jquery@3.3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment