Skip to content

Instantly share code, notes, and snippets.

@mscc-sascha
mscc-sascha / gist:fd8f17dfd0f1317f0b5835896aa509a9
Created October 21, 2025 09:36
Office JS Issue with tracked changes and cut text
name: Basic API call (TypeScript) (2)
description: Performs a basic Word API call using TypeScript.
host: WORD
api_set: {}
script:
content: >
document.getElementById("run").addEventListener("click", () =>
tryCatch(run));
@mscc-sascha
mscc-sascha / Get selected shape types
Created November 18, 2024 08:29
Sample gist to demo the shape.type behaviour
name: Get, set, load, and save shapes
description: Get and set one or more selected shapes. Load and save one or more shapes.
host: POWERPOINT
api_set: {}
script:
content: |
$("#getSelectedShapes").on("click", () => tryCatch(getSelectedShapes));
async function getSelectedShapes() {
// Gets the shapes you selected on the slide and displays their IDs on the task pane.
@mscc-sascha
mscc-sascha / Get File Content.POWERPOINT.yaml
Created November 1, 2023 10:41
Gets the file content of presentation in compressed format
name: Get File Content
description: Gets the file content of presentation in compressed format
host: POWERPOINT
api_set: {}
script:
content: >
$("#run").click(() => tryCatch(run));
const run: Function = async () => {
@mscc-sascha
mscc-sascha / Get File Content.POWERPOINT.yaml
Created October 31, 2023 11:39
Gets the file content of presentation in compressed format
name: Get File Content
description: Gets the file content of presentation in compressed format
host: POWERPOINT
api_set: {}
script:
content: >
$("#run").click(() => tryCatch(run));
const run: Function = async () => {
@mscc-sascha
mscc-sascha / Custom document properties.WORD.yaml
Created August 1, 2023 09:50
Adds and reads custom document properties of different types.
name: Custom document properties
description: Adds and reads custom document properties of different types.
host: WORD
api_set: {}
script:
content: |
$("#read").click(() => tryCatch(readCustomDocumentProperties));
async function readCustomDocumentProperties() {
await Word.run(async (context) => {
@mscc-sascha
mscc-sascha / Get, set, load, and save slides.POWERPOINT.yaml
Created August 1, 2023 07:08
Get and set one or more selected slides. Load and save one or more slides.
name: 'Get, set, load, and save slides'
description: Get and set one or more selected slides. Load and save one or more slides.
host: POWERPOINT
api_set: {}
script:
content: |
$("#getSelectedSlides").click(() => tryCatch(getSelectedSlides));
$("#setSelectedSlides").click(() => tryCatch(setSelectedSlides));
$("#deleteSlides").click(() => tryCatch(deleteSlides));
$("#saveSlideSelection").click(() => tryCatch(saveSlideSelection));