office 在线预览
调用微软的api,将office文档转换为html,然后实现预览。
参考我们的实现方式:http://demo.kalcaddle.com/?user/loginSubmit&name=guest&password=guest
然后最后把得到的地址以iframe方式嵌入到网页即可实现预览
之后发一些,office在线编辑、保存的文章。
还有本地转换的方案,dsoframer。可参考:
http://view.gokuai.com/op/view.aspx?src=http%3A%2F%2Fdemo.kalcaddle.com%2Fdata%2FUser%2Fdemo%2Fhome%2Fdownload%2FC%2B%2B%E4%B8%AD%E5%86%85%E5%AD%98%E5%88%86%E9%85%8D%E5%8F%8A%E5%A0%86%E5%92%8C%E6%A0%88.docx
代码段:
var openOffice = function(url,ext){ var app_url,temp_url; switch (ext) { case 'doc': case 'docx': case 'docm': case 'dot': app_url ='http://sg1b-word-view.officeapps.live.com/wv/wordviewerframe.aspx?ui=zh-CN&rs=zh-CN&WOPISrc='; break; case 'ppt': case 'pptm': case 'pptx': app_url ='http://sg1b-powerpoint.officeapps.live.com/p/PowerPointFrame.aspx?PowerPointView=ReadingView&ui=zh-CN&rs=zh-CN&WOPISrc='; break; case 'xls': case 'xlsb': case 'xlsm': case 'xlsx': app_url = 'http://sg1b-excel.officeapps.live.com/x/_layouts/xlviewerinternal.aspx?ui=zh-CN&rs=zh-CN&WOPISrc='; break; default:break; } temp_url = 'http://sg1b-15-view-wopi.wopi.live.net:808/oh/wopi/files/@/wFileId?wFileId='; temp_url += encodeURIComponent(url); return app_url+encodeURIComponent(temp_url)+'&access_token=1&access_token_ttl=0'; }