Office.js - OSF.OUtil.encodeBase64适用于Word 2013,但在Word 2016中引发异常 [英] Office.js - OSF.OUtil.encodeBase64 works well with Word 2013 but throws exception with Word 2016

查看:120
本文介绍了Office.js - OSF.OUtil.encodeBase64适用于Word 2013,但在Word 2016中引发异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我使用以下代码在Office加载项中编码和解析Word文档

 

 var currentSlice = currentFile.getSliceAsync (0,function(resultSlice){
if(result.status == Office.AsyncResultStatus.Succeeded){
//我们得到了文件切片。现在我们将编码数据并发布到服务
var documentText = OSF.OUtil.encodeBase64(resultSlice.value.data);
//打开文档,存储为base64字符串。
var doc = new openXml.OpenXmlPackage(documentText );
}
}

此代码与Word 2013完美配合,但行 OSF.OUtil.encodeBase64  抛出异常 


对象不支持属性或方法'charCodeAt'


在Word 2016


对于可能的原因有什么看法?



注意我使用了最新的Office.js来自&absp; https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js &
也将清单升级到1.1


< p style ="padding-right:0px;字体大小:15像素;明确:两者;颜色:#222426; font-family:Arial,'Helvetica Neue',Helvetica,sans-serif; line-height:19.5px">



问候,



Jhan Zaib


解决方案

嗨Jhan Zaib,


这是讨论Microsoft Excel问题和反馈的论坛,我会把你的问题转到APP for Office论坛:

https://social.msdn.microsoft.com/Forums/en-US/home?forum=appsforoffice


我们建议适当发布的原因是您将获得最合格的受访者群体,而定期阅读论坛的其他合作伙伴可以分享他们的知识或向您学习与我们互动。感谢您的理解。


问候,


Emi Zhang

TechNet社区支持


Hi,

I have used following code for encoding and parsing Word document in an Office Add-in

var currentSlice = currentFile.getSliceAsync(0, function (resultSlice) {
   if (result.status == Office.AsyncResultStatus.Succeeded) {
  //We got the file slice. Now we will encode the data and post to a service
  var documentText = OSF.OUtil.encodeBase64(resultSlice.value.data);
  // Open the document, which is stored as a base64 string.
  var doc = new openXml.OpenXmlPackage(documentText);
   }
}

This code works perfectly with Word 2013 but line OSF.OUtil.encodeBase64 throws exception 

Object doesn't support property or method 'charCodeAt'

on Word 2016

Any idea about what could be the possible reasons?

Note i have used the latest Office.js from https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js and also upgraded manifest to 1.1

Regards,

Jhan Zaib

解决方案

Hi Jhan Zaib,

This is the forum to discuss questions and feedback for Microsoft Excel, I'll move your question to APP for Office forum:
https://social.msdn.microsoft.com/Forums/en-US/home?forum=appsforoffice

The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.

Regards,

Emi Zhang
TechNet Community Support


这篇关于Office.js - OSF.OUtil.encodeBase64适用于Word 2013,但在Word 2016中引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆