Skip to content

Instantly share code, notes, and snippets.

@AbidRahman-MSFT
AbidRahman-MSFT / Add change text event handler to CC.WORD.yaml
Created July 28, 2021 20:06
Adds a binding to a content control and registers the BindingDataChanged event type.
name: Add change text event handler to CC
description: >-
Adds a binding to a content control and registers the BindingDataChanged event
type.
host: WORD
api_set: {}
script:
content: |+
$("#run").click(() => tryCatch(run));
@AbidRahman-MSFT
AbidRahman-MSFT / GetHtml of document body.WORD.yaml
Created May 26, 2021 17:51
get and print the html of the document body
name: GetHtml of document body
description: get and print the html of the document body
host: WORD
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
await Word.run(async function(context) {
@AbidRahman-MSFT
AbidRahman-MSFT / Get and Set metadata from inline picture
Last active May 11, 2021 23:35
Get and Set metadata from inline picture
name: Use inline pictures
description: Inserts and gets inline pictures.
host: WORD
api_set: {}
script:
content: |
$("#insert").click(() => tryCatch(insertImage));
$("#get").click(() => tryCatch(getData));
var id;
@AbidRahman-MSFT
AbidRahman-MSFT / Scroll to a range.WORD.yaml
Created May 4, 2021 19:28
Scrolls to a range with and without selection.
name: Scroll to a range
description: Scrolls to a range with and without selection.
host: WORD
api_set: {}
script:
content: |
$("#setup").click(() => tryCatch(setup));
$("#scroll").click(() => tryCatch(scroll));
$("#scroll-end").click(() => tryCatch(scrollEnd));
@AbidRahman-MSFT
AbidRahman-MSFT / Get OOxml text content for selection..WORD.yaml
Created April 21, 2021 23:01
Returns the OOxml text content for the selection (even for hidden field codes).
name: Get OOxml text content for selection.
description: >-
Returns the OOxml text content for the selection (even for hidden field
codes).
host: WORD
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
@AbidRahman-MSFT
AbidRahman-MSFT / Get OOxml of document body.WORD.yaml
Created April 9, 2021 21:29
Logs the ooxml of the document body.
name: Get OOxml of document body
description: Logs the ooxml of the document body.
host: WORD
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
await Word.run(async (context) => {
@AbidRahman-MSFT
AbidRahman-MSFT / Get File Url.WORD.yaml
Created March 19, 2021 17:52
Get the current file's URL. If unsaved, will return null.
name: Get File Url
description: 'Get the current file''s URL. If unsaved, will return null.'
host: WORD
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
await Word.run(async (context) => {
name: Print HTML value of document body.
description: ''
host: WORD
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
await Word.run(async (context) => {
name: Set the left indent of a paragraph (w 1.1 and 1.2 API sets only)
description: ''
host: WORD
api_set: {}
script:
content: |
$("#run").click(() => tryCatch(run));
async function run() {
await Word.run(async (context) => {
@AbidRahman-MSFT
AbidRahman-MSFT / Search.WORD.yaml
Created March 9, 2021 16:20
Shows basic and advanced search capabilities.
name: Search
description: Shows basic and advanced search capabilities.
host: WORD
api_set: {}
script:
content: |
$("#setup").click(() => tryCatch(setup));
$("#basic-search").click(() => tryCatch(basicSearch));
$("#wildcard-search").click(() => tryCatch(wildcardSearch));