Questions tagged [office-js]

OfficeJS is the new JavaScript extensibility model for Microsoft Office client applications. You can extend Office applications that run on Windows, web, iOS, and the Mac. This model is applicable to Office client applications starting with Office 2013. Please read the tag info for additional guidance on how to increase the chance that you'll get a high quality answer to your questions.

For questions about the JavaScript and REST based Office Add-ins APIs.

Office.js is a JavaScript library developed by Microsoft and used to develop Office Add-ins (formerly Apps for Office). The library contains functions for every Office application (for example getting data selected by the user) and several objects and functions useful in the development of Outlook add-ins. The library allows you to develop three types of add-ins:

  • Content Add-ins
  • Task Pane Add-ins
  • Mail Add-ins

Content add-ins display and add-in application's contents within a window typically in the middle of an Office application. Task pane add-ins provide the add-in's content in a sidebar, and mail add-ins appear in the body.

Within the library, there are three main API's. The Shared API provides functions and objects useful to all types of add-ins. The Document API provides objects and functions useful in developing Content and Task Pane add-ins. The Mailbox API contains functions and objects useful for Mail add-in development.

Furthermore starting with Office 2016 and corresponding Office365 installations, there is a new set of richer functionality of APIs available for Excel and Word with many hundred new application specific functions available that allow developers to write rich add-ins for these applications.

Add-ins created using this library can run on any Office application regardless of device.

More information on this library may be found on dev.office.com.

When asking questions with this tag, please make sure to follow the points below

  • If you are encountering a new API error OR
  • If you are seeing issues on APIs that used to work OR
  • If you are seeing issues on APIs that are working on other devices / installations of Office

Make sure you to include your Office build version in the question.

should not be used for questions relating to Office Add-ins created using Visual Studio Tools for Office (VSTO) which have their own tag:

5489 questions
1
vote
1 answer

Change what browser is used for displaying office 365 addons

When developing office 365 addons, some of our installations of Office 365 are using Internet explorer to display the addons, and thus debugging is done using the F12 tool. Some of our installations are using Microsoft edge and can be debugged using…
1
vote
1 answer

Determine if conditional formatting is applied to cell or cell range in Office-js

Is there a method with office-js API to determine if conditional formatting has been applied to a cell or cell range? I see there is a method to add conditional formatting but I don't see a method to check for existence of the conditional…
jmadd
  • 115
  • 1
  • 1
  • 6
1
vote
2 answers

Set Dropdown Value Back to Placeholder or Very First Option After onClick Event on a Button?

In the following code, I have a Dropdown and a Button. Once you select an option in the Dropdown and click the Button, that value will be sent to Excel in the active cell. After sending this data to Excel, can I set the Dropdown back to the…
1
vote
0 answers

Certain Users are Unable to Access Add-in

We have setup and are hosting a centrally deployed Add-in for Excel developed with the OfficeJS API. We have had success in building, hosting, and testing the Add-in, but are now seeing a very strange issue that we are having trouble debugging. For…
mmwim
  • 11
  • 1
1
vote
2 answers

How do I get cell number and sheet name of excel by office.js Office.initialize?

Sometime getting the attached image error Getting the below error while running the application in excel add-in. Office.js has not fully loaded. Your app must call "Office.onReady()" as part of it's loading sequence (or set the "Office.initialize"…
BarakJob
  • 51
  • 1
  • 7
1
vote
1 answer

How to Convert String to Range After Awaiting Context.sync?

In the following async function, I am getting the active cell in Excel and then loading the row index. After the context.sync I am creating a string called "newRange". Is there a way that I can set the current range to my "newRange"? I need to…
Ethan
  • 808
  • 3
  • 21
1
vote
2 answers

How Can I Add Two Functions for "value" in TextField?

In the following code, I have a TextField that I want to force all UpperCase letters for the user when they are typing, as well as store the text that the user inputted. I can make the TextField all UpperCase but I wont be able to submit to Excel. I…
Ethan
  • 808
  • 3
  • 21
1
vote
2 answers

Two onChange Events for One TextField is Not Executing Both onChange Events

In the following code, I am trying to execute two onChange events for one TextField. I tried executing both onChange events separately, and they work fine. Why won't both my events run at the same time? When I combined them, only the "handleChange"…
Ethan
  • 808
  • 3
  • 21
1
vote
1 answer

Replace text of current paragraph in MS word Office.js add-in

In a Word add-in, I'm trying to: receive documentSelectionChanged events, get the text of the current paragraph, and replace the string foo with the string bar in the current paragraph. Everything is working except the last part. The text of the…
new name
  • 15,861
  • 19
  • 68
  • 114
1
vote
1 answer

In the Outlook Add-In API for javascript in a Compose Form, is it possible to require a Read Receipt on a message before it's sent?

I'm trying to find out if it's possible from an Outlook Add-In for a Compose Form to add a Read Receipt to a message before it's sent. My company has a form library built in an older version of outlook and an older version of exchange. The form has…
1
vote
1 answer

How do I read the properties of a range in Office.js?

I am trying to read the values of range B2 and write an if statement dependent on what is returned. I keep getting an error and I don't know why. Please see below. function analyzeWorkbook() { // Run a batch operation against the Excel object…
1
vote
1 answer

Office Addin deployment for on-prem solutions for Office 365

We have created an Office Addin that is a client to inputting data into our on prem server. We have users that have on-prem servers that want this Office 365 addin. How do we deploy this to them. Sideloading/Network Share is listed as being…
Ryan Watson
  • 86
  • 2
  • 7
1
vote
1 answer

Setting values of range with an arbitrarily sized array in th Excel Javascript API?

I have some nested array of data, for example something like [[1, 2], [2, 3, 4]], and I'd like to be able to update the values of cells on a specific worksheet with this data efficiently. The problem I'm having is that the data isn't square, and so…
Nate Rush
  • 360
  • 2
  • 14
1
vote
1 answer

Excel.Range.Insesrt Office JS api to add cells to table

I am trying to add cells to the existing table using insert API provided by office js. Microsoft official doc gave sample code to insert in sheet which works fine. Excel.run(function (context) { var sheet =…
Amir
  • 1,855
  • 3
  • 24
  • 40
1
vote
1 answer

Are Outlook addings installation supported in Outlook desktop clients aside from Outlook for Mac?

I am trying to install our custom adding into a Gmail account synchronized with outlook desktop client for Windows, but we are not getting de option from de app. Switching to another office365 inbox works properly.