Skip to content

Instantly share code, notes, and snippets.

@vinaymavi
Last active August 1, 2017 20:26
Show Gist options
  • Save vinaymavi/8aec610291fc27b77c05dee0dd8064a9 to your computer and use it in GitHub Desktop.
Save vinaymavi/8aec610291fc27b77c05dee0dd8064a9 to your computer and use it in GitHub Desktop.
Insert Text in current side. - Shared with Script Lab
name: Insert Image
description: Inserts an image to the current slide.
author: vinaymavi
host: POWERPOINT
api_set: {}
script:
content: |+
$('#insert').click(run);
function run() {
Office.context.document.setSelectedDataAsync("Hello", {
coercionType: Office.CoercionType.Text,
imageLeft: 50,
imageTop: 50,
imageWidth: 400
},
function (asyncResult) {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
console.log(asyncResult.error.message);
}
});
}
language: typescript
template:
content: |-
<p class="ms-font-m">Insert an image into the current slide.</p>
<button id="insert" class="ms-Button">
<span class="ms-Button-label">Run</span>
</button>
language: html
style:
content: "body {\r\n margin: 0;\r\n padding: 10px;\r\n}\r\n\r\n\r\n/* Button customization, including overwriting some Fabric defaults */\r\n\r\n.ms-Button, .ms-Button:focus {\r\n background: #b7472a;\r\n border: #b7472a;\r\n}\r\n\r\n .ms-Button > .ms-Button-label,\r\n .ms-Button:focus > .ms-Button-label,\r\n .ms-Button:hover > .ms-Button-label {\r\n color: white;\r\n }\r\n\r\n .ms-Button:hover, .ms-Button:active {\r\n background: #8e3720;\r\n }\r\n\r\n .ms-Button.is-disabled, .ms-Button:disabled {\r\n background-color: #f4f4f4;\r\n border-color: #f4f4f4;\r\n }\r\n\r\n .ms-Button.is-disabled .ms-Button-label,\r\n .ms-Button:disabled .ms-Button-label {\r\n color: #a6a6a6;\r\n }"
language: css
libraries: |-
// Office.js
https://appsforoffice.microsoft.com/lib/1/hosted/office.js
// NPM libraries
jquery@3.1.1
office-ui-fabric-js@1.4.0/dist/js/fabric.min.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
@microsoft/office-js-helpers@0.7.4/dist/office.helpers.min.js
core-js@2.4.1/client/core.min.js
// IntelliSense: Use dt~library_name for DefinitelyTyped or URLs to d.ts files
@types/office-js
@types/jquery
@types/core-js
@microsoft/office-js-helpers@0.7.4/dist/office.helpers.d.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment