无法在SharePoint加载项iFrame中打开Office文档 [英] Cannot open Office Documents in SharePoint add-In iFrame

查看:99
本文介绍了无法在SharePoint加载项iFrame中打开Office文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个SharePoint Hosted应用程序,该程序使用户可以从用户界面上载Office文档,PDF和视频.当我们单击每个上载的文件时,我们希望它在iFrame中打开.我们已经在Office365和Windows 2000上成功实现了此功能. 它完美地工作.这些文档在O365上的Office Web应用程序上打开.

We have a SharePoint Hosted app that lets user upload office documents , PDF's and videos from the user interface. When we click on each uploaded file , we want it to open in an iFrame. We have successfully implemented this feature on Office365 and it works perfectly . The documents open on Office web app On O365.

但是,相同的代码在内部的sharepoint 2013上不起作用.我们已经成功安装并配置了Office Web应用程序服务器,并希望使用该服务器将加载项中的文档呈现到iFrame中. 但是文档始终会被下载,并且不会在Office Web应用程序的iFrame中打开.屏幕截图粘贴在代码下方.任何帮助将不胜感激

But the same code does not work on sharepoint 2013 on-premise. We have installed and configured an Office web apps server successfully and want to use that to render documents inside our add-in into an iFrame. But the documents when clicked always download and do not open in iFrame in office web apps. Screenshot is pasted below the code .Any help would be appreciated

此处有angularjs代码: 

------------

------------

功能loadSelectedDocument(docUrl){
          var iFrameEle = $('.documentFrame');
          var ext = docUrl.substring(docUrl.lastIndexOf('.')+ 1).toLowerCase();

          var iframeTemplate ='< iframe id ="documentframe" class ="documentViewer" src =" + docUrl +'"样式=宽度:100%;最小高度:420px;文本对齐:居中;高度:100%" 主题</iframe>';
          var videoTemplate ='< video  id ="documentVideo"   class ="documentViewer"控制自动播放src =" + docUrl +'" type ="video/wmv" style ="width:100%; min-height:420px; text-align:center; height:100%"  </video>';

          vm.htmlForSelectedFileType = ext =='mp4'|| ext =='wmv'吗? videoTemplate:iframeTemplate;

          $ .each(iFrameEle,函数(索引,对象){
              $(object).empty().html(vm.htmlForSelectedFileType);
          });
      }

function loadSelectedDocument(docUrl) {
            var iFrameEle = $('.documentFrame');
            var ext = docUrl.substring(docUrl.lastIndexOf('.') + 1).toLowerCase();

            var iframeTemplate = '<iframe id="documentFrame" class="documentViewer" src="' + docUrl + '" style="width:100%;min-height:420px;text-align:center;height:100%">Select Topic</iframe>';
            var videoTemplate = ' <video   id="documentVideo"  class="documentViewer" controls autoplay src="' + docUrl + '" type="video/wmv" style="width:100%;min-height:420px;text-align:center;height:100%">  </video>';

            vm.htmlForSelectedFileType = ext == 'mp4' || ext == 'wmv' ? videoTemplate : iframeTemplate;

            $.each(iFrameEle, function (index, object) {
                $(object).empty().html(vm.htmlForSelectedFileType);
            });
        }

-----------------------------------

-----------------------------------

屏幕截图粘贴在下面.我想知道什么才能使其正常工作?

推荐答案

您好,

对于此问题,请确保首先可以在Office Web Apps中打开库中的文档.

,然后确保支持在Office Web Apps中打开该文件类型,并确保该文件类型是以下其中一种: 受信任的文件(MIME)类型.

And then make sure that the file type is supported to be opened in Office Web Apps, and make sure that the file type is one of the Trusted file (MIME) types.

也请调试代码以查看该功能是否已执行.

最好的问候


这篇关于无法在SharePoint加载项iFrame中打开Office文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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