nam
nam

Reputation: 23749

How can we display data in a browser from Office.js API?

As explained in this SO post, using JavaScript/JQuery, we can convert .docx files to html. We need to display this html in the default browser. In our Office.js add-in for WORD, we can get an html from WORD document but we are not sure how we display it in the browser. For example: user clicks a button in the task pane of the Add-in==>Add-in gets the html from the active Word document==>the Add-in code displays that html in the default browser. Question: Is there any Office.js API etc that will help us display that HTML in default browser?

Upvotes: 0

Views: 562

Answers (2)

killer Bee
killer Bee

Reputation: 11

There are many ways from which you can retrieve data from API and display on browser or DOM , in nodejs , the code would be somewhat like

//the npm library useful
 const request = require('request');
 request({
 url: 'www.example.com',
 json:true
 }
 , (error,response,body)=>{
  //your response will be in response object! Then you can easily display it to browser
 });

Upvotes: 0

Rick Kirkham
Rick Kirkham

Reputation: 9674

I assume there's some reason why displaying it in a tab within the task pane isn't acceptable. (If it is, then that's something to consider.) There's also the Dialog API. It's a window of the default browser, but it doesn't have the browser ribbon or menu bars. If you want a full blown browser window to open, I don't think that there is an API in Office.js that will do that. You might take a look at the standard window.open() method.

Upvotes: 1

Related Questions