javascript-api-for-office

How to open new Word docx document in word Add-in

限于喜欢 提交于 2020-06-10 02:04:38
问题 I have developed a word add-in using word javascript api. My Document .docx file is on server and i need to open that .docx document as a new word document on a button click in add-in. Please guide me how i can open new document in word add-in. Thanks. 回答1: There is a new method we are adding to the API that you can actually use to achieve this. Notice that is in preview, which means will be in production in a couple of months. You need latest Office version plus reference our preview office

Get all the VBA macros of a workbook by JavaScript API for Excel

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 05:09:53
问题 In VBA, we could use for example Wb.VBProject.VBComponents to fetch all the VBA macros of a workbook Wb . Does anyone know if JavaScript API for Excel provides any object or function to access that? 回答1: No, you cannot get the VBA macros out of the workbook using JS APIs. Out of curiosity, why would you want to do it? I.e., what would be the pitch you'd make for having us include this API? ~ Michael Zlatkovsky, developer on Office Extensibility team, MSFT 回答2: I think this github project is

Is there is a way to insert macro to worksheet from Excel Addin?

别来无恙 提交于 2019-12-12 11:20:04
问题 I searched documentation Office Excel API, but cannot find any mentions at all, how it can be implemented. The Problem: Luck of API functionality or some sort of bugs can be solved easily by VBA macros. But, for doing that, we have only two possibilities: Insert macro manually into sheet, which will catch some event on sheet, and JS from addin will trigger that event (this solution came from very old forum (if I will find the link, I will insert it here)). Insert macro by JS code to sheet

JavaScript API for Office getRange method

无人久伴 提交于 2019-12-11 04:45:26
问题 Is there a way to get a range by row , column , numRows , numColumns ? For example: Excel.run(function (ctx) { var sheet = ctx.workbook.worksheets.getActiveWorksheet(); var range = sheet.getRange(1, 2, 3, 4).load("values"); ... }); 回答1: In the next release of ExcelAPI 1.7 we will have worksheet.getRangeByIndexes which is exactly what you are looking for. In the meantime you can achieve the same by doing the following: var range = sheet.getCell(1,2).getResizedRange(3,4); -Philip, Software

Word JS api Access Denied (ContentControl.select, Body.getHtml)

末鹿安然 提交于 2019-12-08 05:14:06
问题 I'm trying to select content control through js select() function - docs - but I'm always getting Access Denied error: Error: { "name": "OfficeExtension.Error", "code": "AccessDenied", "message": "AccessDenied", "traceMessages": [], "debugInfo": { "errorLocation":"ContentControl.select" }, "stack":"AccessDenied: AccessDenied\n at Anonymous function (https://appsforoffice.microsoft.com/lib/1.1/hosted/word-win32-16.00.js:19:150094)\n at yi (https://appsforoffice.microsoft.com/lib/1.1/hosted