office-js

Accessing window.open popup from excel online task pane

和自甴很熟 提交于 2019-12-24 08:05:05
问题 I am currently debugging some code that was done by past developers. We are using the below code to open a new window to authenticate the user (oAuth2 Flow). var oAuth2Window = window.open(_embeddedStartUrl, "Authentication", "location=0,status=0,scrollbars=1,resizable=1,height=600,width=450"); After the user logs in successfully, it's trying to access some properties on oAuth2Window but I am getting: “Access is denied”. The host names are on different servers. This is currently happening in

Workbook Protection stopped working with Excel Online

邮差的信 提交于 2019-12-24 07:58:37
问题 Until a few weeks ago, the workbook protection API was working in Excel Online. Now it gives error as invalid parameter. I'm setting allowInsertColumns: false and allowFormatCells: false . My code looks like this: Excel.run(function (ctx) { var sheet = ctx.workbook.worksheets.getItem("Sheet1"); var range = sheet.getRange("A1:B3").format.protection.locked = false; sheet.protection.protect({ allowInsertColumns: false, allowFormatCells: false }); $('#mytestlabel1').text("Execution of protect api

Office Javascript API: MS Project identify parent task id and sub task id

孤人 提交于 2019-12-24 07:38:23
问题 I am working on building MS Project Web Add-in. Using the below function as a base with other functions I am able to retrieve the task, id and resource name . // Get the maximum task index, and then get the task GUIDs. async getTasks(guids: string[]): Promise<any[]> { return await Promise.all( guids.map(async guid => await this.getTask(guid)) ); } async getTaskGuids(maxIndex: number): Promise<string[]> { const guids = []; for (let i = 0; i <= maxIndex; i++) { guids.push(await this.getTaskGuid

How to see excel API results, custom functions in excel sheet(cell) through Script Lab, instead of console log?

被刻印的时光 ゝ 提交于 2019-12-24 07:35:50
问题 I am using Script lab in office 365 and facing difficulty in writing a function which fetches data from API(url). I need help in merging the below code with custom function in Java Script. from the below code that I am able to get API results in script lab console but I want final results in excel screen(cell). Currently I can see all the ticker.name instead of specific. var request = new XMLHttpRequest(); request.open("GET", "https://api.coinmarketcap.com/v1/ticker/", true); request.onload =

Embed a UserVoice widget in an add-in in Excel for Windows

假如想象 提交于 2019-12-24 07:22:26
问题 (* I clean up the initial thread *) I want to add the UserVoice widget to one Excel add-in. I have made the following example code: <!DOCTYPE html> <html> <head> <script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"></script> <link rel="stylesheet" href="https://appsforoffice.microsoft.com/fabric/1.0/fabric.min.css"> <link rel="stylesheet" href="https://appsforoffice.microsoft.com/fabric/1.0/fabric.components.min.css"> </head> <body> <div id="contact_us">Contact us</div> <

Office.js select text and replace it with a ContentControl

有些话、适合烂在心里 提交于 2019-12-24 07:18:24
问题 I have the following use case using Office.js: search for some text with body.search() after finding the text, can be multiple occurrences, iterate through them and replace them with a ContentControl with a different content The search part is easy, but I'm not sure about the second part. Inserting a ContentControl to the cursor position and manipulating it's HTML content isn't an issue, but I'm not sure if it's possible to programmatically select a string and then replace it with other

How to delete an inserted OOXML comment using Word JS API?

核能气质少年 提交于 2019-12-24 07:15:01
问题 I am trying to insert comments inside word document using insertOoxml method. The comment gets inserted successfully. I want to delete this manually-inserted comment based on one of the user's actions. For example, when they switch from one feature of my add-in to another. I am trying to delete the comment parts from the Ooxml string using regex match and replace for this to work. Word.run(async(context) => { let body = context.document.body let bodyOOXML = body.getOoxml() await context.sync(

On-click event in Add-in created with “yo office” gets invoked for all open documents

一世执手 提交于 2019-12-24 06:40:53
问题 I created react-based word JS plugin with YO OFFICE. What I noticed is that when I open two different word documents (word, online word, mix'n'match) with my plugin loaded then interactions with one instance propagate to another instance. So, context actions supposed to be applied for one word document get applied to all open documents. This is not expected. Any ideas what I'm doing wrong? 回答1: "Yo office" uses BrowserSync for debugging, which has the nice effect of automatically refreshing

Lengthy HTTP calls failing in TaskPane apps on Office for Mac Client

守給你的承諾、 提交于 2019-12-24 06:34:28
问题 We have built an Excel Task Pane add-in that interacts with our server to get data from an external source. For few calls the server takes more than a minute to respond. For such calls, Excel add-in (which runs in Mac Desktop Excel 2016) doesn't receive any response (either success or failure or timeout) even though the server has sent it. Note: This happens only when the add-in runs in Mac Desktop Excel. In other systems and browsers it works fine. Does the Office for Mac client have a low

Attaching an handler to DocumentSelectionChanged event disables the Undo stack on Office for Mac

戏子无情 提交于 2019-12-24 06:32:49
问题 We have run in to, what seems like, a bug in Office.js on Office for Mac . If you attach an event handler to DocumentSelectionChanged event that calls Excel.run the standard Excel "undo" functionality gets disabled. And this remains disabled until the add-in is unloaded (i.e. the event handler is unhooked). You can replicate this problem by (for example), taking the Excel-Add-in-JS-CollegeCreditsTracker sample app and inserting the following block of code in app.initialize method. Office