Can someone provide a simple example of getting DocumentProperties in Office.js?

How to get the author or title of a Word document using Office.js (1.3)?

I read the documentation on documentProperties , but I need an example to get the syntax correctly.

Help rate!

+4
source share
1 answer

The following code snippet gets the author and title of the document and writes these property values ​​to the console.

Word.run(function (context) {
    var document = context.document;
    document.properties.load("author, title");

    return context.sync()
        .then(function () {
            console.log("The author of this document is " + document.properties.author + " and the title is '" + document.properties.title + "'");
        });
});
}

, API- Office.js load() , , . ( load() , .)

+1

Source: https://habr.com/ru/post/1686430/


All Articles