Html 如何在网页中显示嵌入的 excel 文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/168280/
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-28 22:28:02  来源:igfitidea点击:

How do I show an embedded excel file in a WebPage?

asp.nethtmlexcelembed

提问by juan

I want to allow an Excel report to be viewed embedded in a WebPage... is there a way?

我想允许在网页中查看嵌入的 Excel 报告......有办法吗?

  • I don't want to use an ActiveX, or OWC (Office Web Components), I just want to open an existing file from the internet explorer application.

  • I don't want users to download and then open it.

  • 我不想使用 ActiveX 或 OWC(Office Web 组件),我只想从 Internet Explorer 应用程序打开现有文件。

  • 我不希望用户下载然后打开它。

Using an iframe wouldn't be a problem, but my preliminary tests weren't successful

使用 iframe 不会有问题,但我的初步测试并不成功

Any ideas? Is it at all possible?

有任何想法吗?有可能吗?

回答by AaronS

This has to do with the local person's browser set up and not really anything you can do on your end. If they click a link with the .xls(x) extension, the browser determines if it wants to open it itself or in a new window.

这与本地人的浏览器设置有关,而不是您可以做的任何事情。如果他们单击带有 .xls(x) 扩展名的链接,浏览器将确定是要自行打开它还是在新窗口中打开它。

Here is a microsoft page on how to change these settings: http://support.microsoft.com/kb/162059

这是有关如何更改这些设置的微软页面:http: //support.microsoft.com/kb/162059

回答by WebAppsGuy

You should try using the Excel Web App Embedfeature that lets you embed tables and charts from Excel directly on your Web Page. You can even let users interact with the spreadsheet so that they can sort and filter data and use your spreadsheets formulas to calculate make their own calculations all without altering the source.

您应该尝试使用Excel Web App 嵌入功能,该功能可让您直接在网页上嵌入 Excel 中的表格和图表。您甚至可以让用户与电子表格进行交互,以便他们可以对数据进行排序和过滤,并使用您的电子表格公式进行计算,无需更改源即可进行自己的计算。

The Excel Web App and storage is all free from Microsoft. Any data you embed on your Web page can be viewed by all the major destkop and mobile browsers and when you update your spreadsheet the data on your web pages is automatically updated as well.

Microsoft 提供的 Excel Web 应用程序和存储都是免费的。所有主要的桌面和移动浏览器都可以查看您嵌入网页的任何数据,并且当您更新电子表格时,网页上的数据也会自动更新。

回答by Neall

I think your best bet is going to be extracting the data out of the Excel file and displaying it in a regular HTML table. Excel isn't exactly safe to invoke from a web page and not everyone has it anyway.

我认为最好的办法是从 Excel 文件中提取数据并将其显示在常规 HTML 表格中。从网页调用 Excel 并不完全安全,而且并非每个人都拥有它。

回答by DataWiz

Excel Web App allows embedding "live" interactive spreadsheets on a web page. For an example, see http://datawiz.wordpress.com/2011/01/10/how-to-embed-excel-on-a-web-page/

Excel Web App 允许在网页上嵌入“实时”交互式电子表格。例如,请参阅http://datawiz.wordpress.com/2011/01/10/how-to-embed-excel-on-a-web-page/

回答by Peter Howe

Take a look at scribd iPaper Viewer- this is a Flash based Viewer of XLS (and other) docs.

看看scribd iPaper Viewer- 这是一个基于 Flash 的 XLS(和其他)文档查看器。

回答by Richard Ev

MOSS 2007 has a nifty feature called Excel Serviceswhich might fit the bill...

MOSS 2007 有一个漂亮的功能,称为Excel Services,可能符合要求...

回答by Javier

in your comments you say that the Excel file is on the client's filesystem, not on the webserver. i think the security model of sane browsers forbid this; but wouldn't be surprised if setting high permissions to your pages could allow this.

在您的评论中,您说 Excel 文件在客户端的文件系统上,而不是在网络服务器上。我认为理智浏览器的安全模型禁止这样做;但如果为您的页面设置高权限可以允许这样做,也不会感到惊讶。

回答by Diodeus - James MacFarlane

<iframe src="file:\yourpath\yourfile.xls" width="100%" height="500"></iframe>

回答by Roger Newby

Well this is a bit crude but sort of fits the bill.

嗯,这有点粗糙,但有点符合要求。

  1. Select the area of the spreadsheet you wish to display.
  2. Copy this area into MS Paint.
  3. Select the area in Paint and use the Edit/Copy to/ function to save this as a bitmap.
  4. Now load the bitmap as you would any other pic.
  1. 选择要显示的电子表格区域。
  2. 将此区域复制到 MS Paint 中。
  3. 在 Paint 中选择区域并使用 Edit/Copy to/ 功能将其保存为位图。
  4. 现在像加载任何其他图片一样加载位图。