office-js-helpers

How do I add a bookmark within the body of a Word doc using Office JS

我与影子孤独终老i 提交于 2020-07-08 05:53:10
问题 The Office JS has provided the following function in preview, but I couldn't find any example. Here is what I tried but it doesn't seem to work, any idea what I am missing here, since this code inserts the text but the bookmark is not created. Word.run(function (context) { let range = context.document.getSelection(); return context.sync().then(function () { range.insertText(`Test Bookmark`, Word.InsertLocation.replace); let uniqueStr = new Date().getTime(); let bookmarkName = `Test

How do I add a bookmark within the body of a Word doc using Office JS

喜欢而已 提交于 2020-07-08 05:53:09
问题 The Office JS has provided the following function in preview, but I couldn't find any example. Here is what I tried but it doesn't seem to work, any idea what I am missing here, since this code inserts the text but the bookmark is not created. Word.run(function (context) { let range = context.document.getSelection(); return context.sync().then(function () { range.insertText(`Test Bookmark`, Word.InsertLocation.replace); let uniqueStr = new Date().getTime(); let bookmarkName = `Test

displayDialogAsync method of Office.js API not opening the page

家住魔仙堡 提交于 2019-12-24 10:19:05
问题 I used this Microsoft tutorial to build a WORD add-in in VS2017 . The add-in works as expected. Then, for a test, I dded a button btnTest in Home.html file's task pane markup. The btnTest calls the following function in Home.js . When you click the btnTest button in task pane the first line of the code (now commented out) opens the specified url in a browser but the second line does nothing. How can I make displayDialogAsync(…) work here? I'm using Office 2016 desktop version : function

Blank Auth Dialog Window in Outlook React Addin

北战南征 提交于 2019-12-23 00:51:36
问题 I have tried using Dialog API and office-js-helpers for authenticating users in my Outlook Addin React app and both of them create pop-ups for auth but they are both blank screens. Both methods return the following error The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the

How to define Excel using microsoft office-js in Angular 6

流过昼夜 提交于 2019-12-13 06:31:37
问题 I am following this site to integrate office js On declaring like this: import * as Excel from '@microsoft/office-js/excel' It's showing compile time error: Cannot find module '@microsoft/office-js/excel' On declaring like this: declare var Excel: any It's showing run time error: ERROR ReferenceError: Excel is not defined Please suggest how to declare it. I need to use it like this: Excel.run(session, (context){ ... }); 回答1: Install office type definition: npm install --save @types/office-js

Is there any Office.js API to get user input

大憨熊 提交于 2019-12-11 14:57:01
问题 In task pane of our Office.js WORD add-in, we need to get a user input and display in the document. Is it even possible to get user input in an Office.js add-in. If so, is there any Office.js API for that? 回答1: please check our this article with details on how to do it.https://docs.microsoft.com/en-us/office/dev/add-ins/develop/dialog-api-in-office-add-ins 来源: https://stackoverflow.com/questions/52846385/is-there-any-office-js-api-to-get-user-input

Office.js web WORD add-in: window.open() method is not working with “about:blank” URL

一世执手 提交于 2019-11-29 12:33:55
Summary : window.Open('') or window.Open('about:blank') works with JavaScript in a normal html file as can be tested here . But it does not seem to work in an Office.js add-in. Details : On my Windows 10 desktop with VS2017 I created this Office.js WORD add-in project that works perfectly with my Microsoft Office Home and Student 2016 edition. In the same project, I then created a new button btnTest in the home.js file. When I click btnTest it successfully calls the following MyTest method and opens a new window with window.Open('some URL') . But in the same MyTest method when I call window