Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JuaneloJuanelo/a9155f0af862e19edf8b119c53d05d52 to your computer and use it in GitHub Desktop.
Save JuaneloJuanelo/a9155f0af862e19edf8b119c53d05d52 to your computer and use it in GitHub Desktop.
Shows how to get built-in document properties. - Shared with Script Lab
name: Get built-in document properties.
description: Shows how to get built-in document properties.
host: WORD
api_set: {}
script:
content: |+
$("#run").click(getProperties);
function getProperties() {
Word.run(function (context) {
var builtInProperties = context.document.properties;
context.load(builtInProperties);
return context.sync()
.then(function () {
console.log(JSON.stringify(builtInProperties, null, 4));
});
})
.catch(OfficeHelpers.Utilities.log);
}
language: typescript
template:
content: |4
<h2 class="ms-font-m">This sample demonstrates how to set headers.</h2>
<button id="run" class="ms-Button">
<span class="ms-Button-label">Get built-in properties</span>
</button>
language: html
style:
content: |-
body {
margin: 0;
padding: 10px;
}
/* Button customization, including overwriting some Fabric defaults */
.ms-Button, .ms-Button:focus {
background: #2b579a;
border: #2b579a;
}
.ms-Button > .ms-Button-label,
.ms-Button:focus > .ms-Button-label,
.ms-Button:hover > .ms-Button-label {
color: white;
}
.ms-Button:hover, .ms-Button:active {
background: #204072;
}
.ms-Button.is-disabled, .ms-Button:disabled {
background-color: #f4f4f4;
border-color: #f4f4f4;
}
.ms-Button.is-disabled .ms-Button-label,
.ms-Button:disabled .ms-Button-label {
color: #a6a6a6;
}
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