我们目前正在开发PowerPoint加载项,但我们无法在PowerPoint Online中使用幻灯片放映(全屏),最近导致它被Office商店拒绝。
以下是基于How-To guide:
重现错误的最小示例的index.html
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. -->
<!-- See LICENSE in the project root for license information -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My Office Add-in</title>
<!-- Office JavaScript API -->
<script type="text/javascript" src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.debug.js"></script>
<!-- LOCAL -->
<link rel="stylesheet" href="node_modules/office-ui-fabric-js/dist/css/fabric.min.css" />
</head>
<body class="ms-font-m ms-welcome">
<h1>Hello World</h1>
<script type="text/javascript" src="node_modules/core-js/client/core.js"></script>
<script type="text/javascript" src="node_modules/jquery/dist/jquery.js"></script>
<script type="text/javascript" src="node_modules/office-ui-fabric-js/dist/js/fabric.js"></script>
<script type="text/javascript" src="app.js"></script>
</body>
</html>
app.js
"use strict";
(function() {
// The initialize function must be run each time a new page is loaded
Office.initialize = function(reason) {
$(document).ready(function() {
$("#run").click(run);
});
};
function run() {
return PowerPoint.run(function(context) {
/**
* Insert your PowerPoint code here
*/
return context.sync();
});
}
})();
反的manifest.xml
<?xml version="1.0" encoding="UTF-8"?>
<OfficeApp
xmlns="http://schemas.microsoft.com/office/appforoffice/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0"
xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="ContentApp">
<Id>71a1a0ed-6cd0-4a6e-ad2d-015b8a8b43cb</Id>
<Version>1.0.0.0</Version>
<ProviderName>Test</ProviderName>
<DefaultLocale>en-US</DefaultLocale>
<DisplayName DefaultValue="DisplayName" />
<Description DefaultValue="Description"/>
<IconUrl DefaultValue="https://localhost:3004/assets/icon-32.png" />
<HighResolutionIconUrl DefaultValue="https://localhost:3004/assets/hi-res-icon.png"/>
<AppDomains></AppDomains>
<Hosts>
<Host Name="Presentation" />
</Hosts>
<DefaultSettings>
<SourceLocation DefaultValue="https://localhost:3004/index.html" />
</DefaultSettings>
<Permissions>ReadWriteDocument</Permissions>
<VersionOverrides
xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
<Hosts>
<Host xsi:type="Presentation"></Host>
</Hosts>
<Resources></Resources>
</VersionOverrides>
</OfficeApp>
我们正在使用浏览器同步服务我们的加载项,如操作指南中所述。当我将它添加到PowerPoint Online中的空白演示文稿时,它似乎按预期工作(a different bug when refreshing described here除外),直到我尝试进入幻灯片放映(全屏)模式。我在全屏幕上看到加载动画几秒钟,然后我又回到了之前的编辑器模式。
以下是尝试进入幻灯片模式时Chrome开发者工具控制台中显示的错误:
拒绝获取不安全的标题“X-WacCluster”
拒绝获取不安全的标题“X-SupportSVGInWebGL”
无法加载https://euc-powerpoint.officeapps.live.com/pods/RemoteUls.ashx:“Access-Control-Allow-Origin”标头包含多个值“https://contentstorage.osi.office.net,https://contentstorage.osi.office.net”,但只允许一个。因此,不允许原点“https://contentstorage.osi.office.net”访问。
未捕获的TypeError:无法读取属性“$ 37”的null 在PPTe。$ 22. $ 17a(VM3959 11b10a4995dd8c5f.js:10)
我们如何确保我们的插件在幻灯片放映模式下正常工作?