Html 如何在浏览器中打开 Excel 文件,而不是在 Excel 应用程序中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8489519/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 11:58:30  来源:igfitidea点击:

How to open Excel file in browser, not in excel application

htmlexcel

提问by Manoj

I want open Ms-Excel file to open in browser only, i have written following code

我只想在浏览器中打开 Ms-Excel 文件,我编写了以下代码

<a href="file.xls">file</a>

but when i'm clicking that link, it always popups a dialog box for open and save, when i open the file opens in Ms-excel not in browser.

但是当我单击该链接时,它总是会弹出一个用于打开和保存的对话框,当我打开文件时,它会在 Ms-excel 中而不是在浏览器中打开。

Is there any way to open excel file in browser only.?

有没有办法只在浏览器中打开excel文件。?

回答by Nagibaba

add this slug before your link http://view.officeapps.live.com/op/view.aspx?src=. Exactly like this <a href"http://view.officeapps.live.com/op/view.aspx?src=file.xls">show file</a>. http://officewebviewer.com/

在您的链接之前添加此 slug http://view.officeapps.live.com/op/view.aspx?src=。正是这样<a href"http://view.officeapps.live.com/op/view.aspx?src=file.xls">show file</a>http://officewebviewer.com/

回答by RakeshReddy s

If you want to open excel with simple steps and no extra code then go for this. Ref >> https://products.office.com/en-IN/office-online/view-office-documents-online?legRedir=true&CorrelationId=e5efa806-45b2-4a32-8801-c1f5818b1e2c. the code for that is as below. this you can use for Docx file view as well.Ref ImageHtml:

如果你想用简单的步骤打开 excel 而不需要额外的代码,那么就去做吧。参考 >> https://products.office.com/en-IN/office-online/view-office-documents-online?legRedir=true&CorrelationId=e5efa806-45b2-4a32-8801-c1f5818b1e2c。代码如下。这也可以用于 Docx 文件视图。参考图片Html:

<a style="color:blue;display:inline; " href="{{Newdocument_Path}}" target="_blank">{{DocumentName}}</a>

JS:

JS:

var Newdocument_Path = "https://view.officeapps.live.com/op/view.aspx?src=" + your Excell filepath;

回答by Charles Williams

Yes you can do this using SkyDrive: see http://www.excelmashup.com/Content/GettingStarted.html

是的,您可以使用 SkyDrive 执行此操作:请参阅http://www.excelmashup.com/Content/GettingStarted.html

回答by NickEntin

Upload it to Google Drive (what used to be Google Docs). Open the document, click on Share, and then link to that address.

将其上传到 Google Drive(以前是 Google Docs)。打开文档,单击共享,然后链接到该地址。