Office 2016 Addin - Is possible Open remote file on startup addin?

南楼画角 提交于 2019-12-12 05:44:58

问题


Is possible open a remote file (url, xml, binary) ?

For example, I open a dummy docx with Add-In (from url) then the Addin retrieve a xml docx from url and put it in opened document (replace document dummy).

Is possible?

Thanks.

P.S.: I create a Addin and I retrieve a xml docx from url on open dummy file but I fail to put into opened document (replace).


回答1:


If I understand correctly, you are close to doing what you want. Once you have the docx file, then you need to base64 encode it. Here's a SO post about this. Once it is encoded, then you'll use the insertFileFromBase64 method on the Body object.

bodyObject.clear(); 
bodyObject.insertFileFromBase64(base64docxfile); 

Here's a related example that does the base64 encoding on the service (different than what you want), and then clears the dummy doc and opens the docx file in the client.



来源:https://stackoverflow.com/questions/34931144/office-2016-addin-is-possible-open-remote-file-on-startup-addin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!