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

2019-03-28 07:06发布

问题:

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

  • 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.

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

Any ideas? Is it at all possible?

回答1:

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.

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



回答2:

You should try using the Excel Web App Embed feature 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.

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.



回答3:

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.



回答4:

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



回答5:

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



回答6:

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/



回答7:

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.



回答8:

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


回答9:

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.