Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Viewing an excel worksheet without excel

Is there a .NET class which would display an excel worksheet without excel being installed on the user's machine?

Arab who worships Camels
Wednesday, May 21, 2003

If you're not fussed about the formatting then you could get at just the data via the Jet (Access) OleDb interface:

OleDbConnection conn = new OleDbConnection(
    @"Provider=Microsoft.Jet.OLEDB.4.0; " +
    @"Data Source=""c:\test.xls""; " +
    @"Extended Properties=""Excel 8.0; HDR=Yes; IMEX=1""");

OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", conn);
DataTable table  = new DataTable();
adapter.Fill(table);

dataGrid1.DataSource = table;


Connection string courtesy of www.connectionstrings.com .

Duncan Smart
Wednesday, May 21, 2003

P.S. MDAC will probably need to be up-to-date (ver 2.7) on the user's machine.

Duncan Smart
Wednesday, May 21, 2003

Not sure if this is what you're after, but anyway - have a look here:

http://office.microsoft.com/downloads/2000/xlviewer.aspx

Eivind
Thursday, May 22, 2003

Just to clarify - I was thinking that if you have that viewer installed, you might be able to use a WebBrowser-control for displaying Excel-sheets. Not that I've tried it myself -  just a thought.

Eivind
Thursday, May 22, 2003

*  Recent Topics

*  Fog Creek Home