Created
October 6, 2022 10:36
-
-
Save scips/547b1f3e032a56c147c3c138d09ddde4 to your computer and use it in GitHub Desktop.
Gets the title, index, and ID of the selected slide(s).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Get slide metadata | |
description: 'Gets the title, index, and ID of the selected slide(s).' | |
host: POWERPOINT | |
api_set: {} | |
script: | |
content: | | |
$("#get-slide-metadata").click(getSlideMetadata); | |
function getSlideMetadata() { | |
Office.context.document.getSelectedDataAsync(Office.CoercionType.SlideRange, function(asyncResult) { | |
if (asyncResult.status === Office.AsyncResultStatus.Failed) { | |
console.error(asyncResult.error.message); | |
} else { | |
let slide_titles=[]; | |
if (asyncResult.value['slides'] !== null) { | |
for (let slide of asyncResult.value['slides']) { | |
slide_titles.push(slide['title']); | |
} | |
$("#slide-titles").text(slide_titles.join("\n")); | |
console.log(slide_titles); | |
} | |
//console.log(JSON.stringify(asyncResult.value, null, 4)); | |
} | |
}); | |
} | |
language: typescript | |
template: | |
content: "<section class=\"ms-font-m\">\n\t<p class=\"ms-font-m\">Get slide Titles.</p>\n\t<p class=\"ms-font-m\">Select one or more slides and click <b>Get slide Titles</b></p>\n</section>\n\n<button id=\"get-slide-metadata\" class=\"ms-Button\">\n <span class=\"ms-Button-label\">Get slide Titles</span>\n</button>\n\n<textarea id=\"slide-titles\">\n\n</textarea>" | |
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://appsforoffice.microsoft.com/lib/1/hosted/office.js | |
@types/office-js | |
[email protected]/dist/css/fabric.min.css | |
[email protected]/dist/css/fabric.components.min.css | |
[email protected]/client/core.min.js | |
@types/core-js | |
[email protected] | |
@types/[email protected] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment