office-js

Office Word JS - Content Control from Table Selection

為{幸葍}努か 提交于 2019-12-11 03:39:43
问题 I am working on a Word add-in, using the Office JS API, trying to add a Content Control around a Table Binding in the document. The issue I am experiencing is after the Binding around the table is selected, using goToByIdAsync() , the Content Control is created around the last row of the table only, not the selection. Returning the value of ctx.document.getSelection() I can see the selected Range is only the last row in the Selected Table. I need to use the Binding object to know the selected

Identify Active Chart and Selected Chart Element in Office-JS

泪湿孤枕 提交于 2019-12-11 03:04:23
问题 I cobbled together some JavaScript to label the last point of each series in a chart (see below). This is a simplified version of a much-used function in a VBA add-in. I used let mychart = mysheet.charts.getItemAt(0); to specify that the code should run on the first chart object on the worksheet. It would be more useful to run the code on the chart selected by the user. How do I identify which chart the user has selected ( ActiveChart in VBA-speak)? Similarly I used for (var iseries = 0;

Authenticating a REST request in an Excel Add-in

安稳与你 提交于 2019-12-11 02:55:16
问题 I am trying to develop an add-in for Excel with the goal that it will create calendar events based on data inside a spreadsheet. I can do almost everything that I want except use the REST API to build the events in the calendar and I can't exactly figure out where I went wrong. I have followed the documentation suggested by @MarcLaFleur. I can build and run the application no problem, but when I click on the 'Get my files from OneDrive' button, I get the following: Code: 5001 Message: An

Equivalent to Application.ScreenUpdating Property in office-js Excel add-in

牧云@^-^@ 提交于 2019-12-11 02:37:37
问题 I am inserting a lot of data into a sheet and the screen flickers when doing so. In VBA and com add-ins there's a property I can set to delay the updates until they're finished. Is there an equivalent to Application.ScreenUpdating Property in office-js add-ins for excel? 回答1: There is no equivalent for it in Office.js -- not yet, at any rate. There are a number of technical issues that prevent this (FWIW, if you're curious, try toggling ScreenUpdating in VBA while you have a taskpane open;

Outlook Javascript API - window.open not working from Outlook 2016 Desktop/Windows

喜欢而已 提交于 2019-12-11 02:36:33
问题 I have an Office Add-In written in the new JavaScript API, inside of it, I have a JS function which after some logic opens a web app in a new window using window.open(url, '_blank') It works when called from the add-in pane in Outlook Web in both, localhost hosted add-in, as well as after deployment on heroku. However when called from a command (add-in button on ribbon) it works only when the add-in is hosted on localhost, after I deploy it on heroku, the add-in works, shows commands in the

How can i get the document title in Office 365 JavaScript API?

妖精的绣舞 提交于 2019-12-11 02:12:09
问题 I am writing an office add-in with angularjs, i need to get and set document title (that seen at that the top of the document). this is my code: function run() { Word.run(function (context) { var properties = context.document.properties; context.load(properties); return context.sync() .then(function() { console.log('thisDocument.properties.title', properties.title); }) }) .catch(function(error) { OfficeHelpers.UI.notify(error); OfficeHelpers.Utilities.log(error); }); } but in console didn't

Must Office.initialize always be set?

拈花ヽ惹草 提交于 2019-12-11 01:25:40
问题 I have an Office.js Task Pane add-in that doesn't do anything with the Office API until the user performs a specific action on the task pane UI. The UI is an angular.js SPA. So, naturally, there's nothing I need to do on Office.initilize. But, I kept running in to the below error until I gave Office.initilize an empty function. SCRIPT5022: Unhandled exception at line 11, column 10360 in https://localhost:44300/Scripts/Office/1/office.js 0x800a139e - JavaScript runtime error: Office.js has not

Office.context.ui.displayDialogAsync throws 5001 Internal Error

与世无争的帅哥 提交于 2019-12-11 01:22:00
问题 I'm creating a new Outlook Mail add-in using the Visual Studio project template, where I get a sample displaying properties of the currently selected email. I've added a button with a click event handler to open a dialog using this code: $('#clickMeButton').click(function () { Office.context.ui.displayDialogAsync('https://localhost/OutlookAddinTest/MessageDialog.html', { height: 40, width: 40, requireHTTPS: true }, function (result) { _dlg = result.value; _dlg.addEventHandler(Microsoft.Office

Outlook add ins saveAsync is not returning itemid anymore in OWA

对着背影说爱祢 提交于 2019-12-11 01:12:33
问题 In Outlook Appointment Compose mode Office.context.mailbox.item.saveAsync(function (result) { app.showNotification(result.value); }); Is not returning the itemid anymore, but rather some strange string (ex: CLCID:M9_1473129000000_1473130800000__Busy_false_false) and then the whole addin and appointment dialog is closing. Seems to be a bug introduced by a OWA update? Works fine in the Outlook desktop version. Is there any workarounds to save an item and get the itemid? 回答1: I can surely say

insert image programmatically office 365 excel Add-in

允我心安 提交于 2019-12-11 00:29:32
问题 We are developing Office 365 Excel Add-In using office js version 1.1, we are creating table and inserting data using tablerows , now we need to display images in cells in one of column. can anyone help how we can achieve that using office js? 回答1: There is a somewhat limited way of doing it using the getSelectedDataAsync API and the ImageCoercuon type. I know that this works on the Desktop but not sure offhand about Office Online, Mac, or iOS. See https://dev.office.com/reference/add-ins