我开发了一个非常简单的 taskPane 加载项,我想在 Excel Online 中进行测试。我使用 Visual Studio 2015 和 Javascript Api for Office,并开始了一个新项目 Office/Sharepoint --> 然后我选择了任务窗格选项。我对他们构建的示例所做的唯一更改是在 Home.js 中:
/// <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 Developer 站点打开此 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 函数中“卡住”了。你能帮帮我吗?