Office 2016 Addin - Is possible Open remote file o

2019-09-18 18:19发布

问题:

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.