Skip to content

Instantly share code, notes, and snippets.

View jipyua's full-sized avatar

MSFT-jipyua jipyua

View GitHub Profile
@jipyua
jipyua / html with image.WORD.yaml
Created March 27, 2023 05:39
Inserts, updates, and retrieves content controls.
name: html with image
description: 'Inserts, updates, and retrieves content controls.'
host: WORD
api_set: {}
script:
content: >-
$("#insert").click(() => tryCatch(insertPreHtml));
async function insertPreHtml() {
@jipyua
jipyua / close.EXCEL.yaml
Created March 7, 2023 05:45
Create a new snippet from a blank template.
name: close
description: Create a new snippet from a blank template.
host: EXCEL
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
await Excel.run(async (context) => {
@jipyua
jipyua / Preview API testing.WORD.yaml
Created March 7, 2023 04:52
Formats text with pre-built styles.
name: Preview API testing
description: Formats text with pre-built styles.
host: WORD
api_set: {}
script:
content: |
$("#add-preset").click(() => tryCatch(addPreStyledFormattedText));
async function addPreStyledFormattedText() {
await Word.run(async (context) => {
const fields = context.document.getSelection().insertField("Start", Word.FieldType.author);
@jipyua
jipyua / TableBinding.WORD.yaml
Created November 30, 2022 08:46
Performs a basic Word API call using TypeScript.
name: TableBinding
description: Performs a basic Word API call using TypeScript.
host: WORD
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(insertTable));
$("#run2").click(() => tryCatch(addBinding));
async function insertTable() {
@jipyua
jipyua / DocumentCustomXmlPart.WORD.yaml
Created September 5, 2022 05:30
Create a new snippet from a blank template.
name: DocumentCustomXmlPart
description: Create a new snippet from a blank template.
host: WORD
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
$("#run2").click(() => tryCatch(run2));
$("#run3").click(() => tryCatch(run3));
$("#run4").click(() => tryCatch(run4));
@jipyua
jipyua / InsertFileFromBase64 (1).WORD.yaml
Created August 25, 2022 10:04
Performs a basic Word API call using TypeScript.
name: InsertFileFromBase64 (1)
description: Performs a basic Word API call using TypeScript.
host: WORD
api_set: {}
script:
content: |
$("#file").change(getBase64);
$("#insert-sheets").click(() => tryCatch(createDocument));
let externalDoc;
@jipyua
jipyua / Perf testing gist for Field API.WORD.yaml
Created July 27, 2022 10:35
This sample shows how to get existing fields.
name: Perf testing gist for Field API
description: This sample shows how to get existing fields.
host: WORD
api_set: {}
script:
content: |
$("#get-all").click(() => tryCatch(getAllFields));
$("#get-all-code").click(() => tryCatch(getAllFieldsCode));
$("#get-all-result").click(() => tryCatch(getAllFieldsResult));
$("#setup").click(() => tryCatch(setup));
@jipyua
jipyua / InsertFileFromBase64.WORD.yaml
Created July 7, 2022 04:26
Performs a basic Word API call using TypeScript.
name: InsertFileFromBase64
description: Performs a basic Word API call using TypeScript.
host: WORD
api_set: {}
script:
content: |
$("#file").change(getBase64);
$("#insert-sheets").click(() => tryCatch(insertDocument));
let externalDoc;
@jipyua
jipyua / Style Custom Function -No Enums (1).EXCEL.yaml
Last active February 28, 2022 12:46
Custom function that return a Style data type.
name: Style Custom Function -No Enums (1)
description: Custom function that return a Style data type.
host: EXCEL
api_set: {}
script:
content: >
// Azure Functions endpoint
//const endpoint = "http://localhost:7071"; // Local
@jipyua
jipyua / Style Custom Function -No Enums.EXCEL.yaml
Created February 28, 2022 12:28
Custom function that return a Style data type.
name: Style Custom Function -No Enums
description: Custom function that return a Style data type.
host: EXCEL
api_set: {}
script:
content: >
// Azure Functions endpoint
//const endpoint = "http://localhost:7071"; // Local