Question

I would like to output a table to a webpage. The table is stored in an excel sheet (xls).

Is it possible to use xslt for this? The table is the cells are in this range: A26 - P36 (16 columns and 11 rows)

If an exmaple file is need here is a link: http://finans.opengate.dk/media/6704/2010-01-13.xls

Update: A daily file is uploaded. And I would like to automatically show a table from the latest xls-file using xslt. If some C# is needed to convert it from excel to something else (XML?) that is fine. It is done in the CMS Umbraco and that is why I hope to use XSLT since that is the way to show things in Umbraco, through xslt makroes.

BR. Anders

UPDATE with answer (based on answers below): No, it is not possible to read xls-files using xslt. If needed then one has to save excel sheet in another format xml or html. Or one will need a real programming language to read the excel file.

Was it helpful?

Solution

XSLT is mostly used to convert XML from one dialect to another, not to convert xls files to html.

If you just want to do this manually, you can save your worksheet as HTML directly in excel.

It is not clear from your question if you want to do this programmatically, and if so using what programming language.

OTHER TIPS

You can use ADO.net to access cells in an excel file, similar to a DB query. This is a bit lighter than trying to use Excel automation objects.

http://support.microsoft.com/kb/316934

SpreadsheetGear for .NET can read Excel files and display them in a DataGrid as shown in the Excel to DataGrid sample on this page:

    // Create a workbook from an Excel file
    String ssFile = Server.MapPath("files/spiceorder.xls");
    SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook(ssFile);
    // Get a DataSet from an existing defined name
    DataSet dataSet = workbook.GetDataSet("orderrange", SpreadsheetGear.Data.GetDataFlags.FormattedText);
    // Bind a DataGrid to the DataSet
    DataGrid1.DataSource = dataSet;
    DataGrid1.DataBind();

SpreadsheetGear can also render png/gif/jpg images from cell ranges or charts as demonstrated here.

You can download the free trial here if you want to try it yourself.

Disclaimer: I own SpreadsheetGear LLC

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top