我开发了一个非常简单的taskPane外接程序,我想在Excel Online中进行测试。我使用了Visual Studio 2015和Javascript Api for Office,并开始了一个新项目Office/Sharepoint - >然后我选择了任务窗格选项。 我改变他们打造的样品的唯一事情是在Home.js:Office API的JavaScript API getFileAsync函数不调用回调
/// <reference path="../App.js" />
(function() {
"use strict";
// The initialize function must be run each time a new page is loaded
Office.initialize = function (reason) {
$(document).ready(function() {
app.initialize();
$('#get-crazy').click(getCrazy);
});
};
// Reads data from current document selection and displays a notification
function getCrazy(){
Office.context.document.getFileAsync(Office.FileType.Compressed, {sliceSize: 2097152},
function (result) {
if (result.status === Office.AsyncResultStatus.Succeeded) {
console.log("I'm here :D ");
} else {
app.showNotification('Error:', result.error.message);
}
}
);
}
})();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title></title>
<script src="../../Scripts/jquery-1.9.1.js" type="text/javascript"></script>
<link href="../../Content/Office.css" rel="stylesheet" type="text/css" />
<script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js" type="text/javascript"></script>
<!-- To enable offline debugging using a local reference to Office.js, use: -->
<!-- <script src="../../Scripts/Office/MicrosoftAjax.js" type="text/javascript"></script> -->
<!-- <script src="../../Scripts/Office/1.1/office.js" type="text/javascript"></script> -->
<link href="../App.css" rel="stylesheet" type="text/css" />
<script src="../App.js" type="text/javascript"></script>
<link href="Home.css" rel="stylesheet" type="text/css" />
<script src="Home.js" type="text/javascript"></script>
</head>
<body>
<div id="content-header">
<div class="padding">
<h1>Welcome</h1>
</div>
</div>
<div id="content-main">
<div class="padding">
<button id="get-crazy"> SURPRISE! </button>
</div>
</div>
</body>
</html>
我也改变了清单,以便其startAction指出了InternetExplorer的和我使用的是sharePoint开发人员网站打开此Excel Online。 当我运行代码,我得到这个消息:
XML5619: Incorrect document syntax.
Line: 1, Column 1
SEC7111: HTTPS security is compromised by res://ieframe.dll/http_500.htm
SEC7111: HTTPS security is compromised by res://ieframe.dll/ErrorPageTemplate.css
SEC7111: HTTPS security is compromised by res://ieframe.dll/errorPageStrings.js
SEC7111: HTTPS security is compromised by res://ieframe.dll/httpErrorPagesScripts.js
SEC7111: HTTPS security is compromised by res://ieframe.dll/info_48.png
SEC7111: HTTPS security is compromised by res://ieframe.dll/bullet.png
SEC7111: HTTPS security is compromised by res://ieframe.dll/bullet.png
SEC7111: HTTPS security is compromised by res://ieframe.dll/down.png
SEC7111: HTTPS security is compromised by res://ieframe.dll/down.png
SEC7111: HTTPS security is compromised by res://ieframe.dll/background_gradient.jpg
当我按下按钮我只有这个:Agave.HostCall.IssueCall。而且我知道它在'getFileAsync'函数中'卡住'了。你能帮我吗?
那么,这个功能不支持朝向Excel桌面,我试过它使用Word的本地副本,它的工作原理很好 –