我们如何在浏览器中显示来自 Office.js API 的数据?

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

如本 , 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 等中所述,这将帮助我们在默认浏览器中显示 HTML?

有很多方法可以从 API 检索数据并在浏览器或 DOM 上显示,在 nodejs 中,代码有点像

//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
 });

我认为有一些原因导致无法在任务窗格的选项卡中显示它。 (如果是,则需要考虑。)还有 Dialog API。它是默认浏览器的 window,但没有浏览器功能区或菜单栏。如果您想要打开一个功能完善的浏览器 window,我认为 Office.js 中没有 API 可以做到这一点。您可以查看标准的 window.open() 方法。