Document.GetFileProperties Excel web api的同步方法在未保存的Excel文档中失败
使用Excel版本1803(Build 912xxxxx),方法getFilePropertiesAsync在未保存的文件上执行时不会返回成功。我在ScriptLab中对未保存的Excel文档执行了代码段。如果在保存的Excel文档中执行,则代码工作正常Document.GetFileProperties Excel web api的同步方法在未保存的Excel文档中失败,excel,office-js,Excel,Office Js,使用Excel版本1803(Build 912xxxxx),方法getFilePropertiesAsync在未保存的文件上执行时不会返回成功。我在ScriptLab中对未保存的Excel文档执行了代码段。如果在保存的Excel文档中执行,则代码工作正常 Office.context.document.getFilePropertiesAsync(function (asyncResult) { if ((asyncResult.status === Office.AsyncResult
Office.context.document.getFilePropertiesAsync(function (asyncResult) {
if ((asyncResult.status === Office.AsyncResultStatus.Succeeded)) {
var savedURL = asyncResult.value.url;
if (!(savedURL === 'undefined')) {
console.log("Not undefined save location");
if (!(savedURL == null)) {
console.log("Not null save location");
console.log(savedURL);
}
}
}
else
{
console.log("Call failed");
}
});
同样的代码片段在Word中也可以使用,即使是未保存的文档,根据API的要求,也可以在Excel中使用。这是Excel API中缺少的功能吗?目前看来,检查(asyncResult.status==Office.AsyncResultStatus.successed)似乎是解决此问题的唯一方法