使用Web加载项将SharePoint Online文档(docx / dotx)内容加载到Word Online-Context.document.body

时间:2018-09-11 10:43:27

标签: office-js office-addins sharepoint-rest-api

我正在使用Word Web加载项,我在SharePoint在线文档库中存储了一些Word / PowerPoint模板。我创建了一个加载项来选择模板。从Taskpane加载项中选择模板后,我使用rest api(请参阅下面的rest url)从Sharepoint Online中提取文件内容-

"https://xyz.sharepoint.com/sites/Templates/_api/web/getfolderbyserverrelativeurl('/sites/Templates/Word/')/Files('Template1.dotx')/$value"

我想将此文件内容加载到打开的文档中,我没有得到rest api返回哪种格式的文件内容,我发现我们可以使用

插入base64文件。
body.insertFileFromBase64(base64String, Word.InsertLocation.replace);

任何人都可以帮忙,如何在Word Online打开的文档中加载模板文件内容。预先感谢。

0 个答案:

没有答案