Displaying Excel file in browser using Excel Viewer

I am trying the display a complex Excel file in a web form. The Excel viewer has the option to bind data from database. How Can I display the data from my existing xls file?

If you installed

you can see the following sample code in the demo project to load an existing xls file:


private void Button1_Click(object sender, System.EventArgs e)
{
string path = MapPath(“”);
path = path.Substring(0, path.LastIndexOf(“\”));
string fileName = path + “\File\List.xls”;
// Import from a excel file
ExcelViewer1.WebWorksheets.Clear();

ExcelViewer1.WebWorksheets.ImportExcelFile(fileName);


ExcelViewer1.SaveSessionData();
ExcelViewer1.RefreshControl();
}