XML File as Excel file.

Posted by FrustratedWithFormsDesigner on Stack Overflow See other posts from Stack Overflow or by FrustratedWithFormsDesigner
Published on 2010-04-07T19:55:37Z Indexed on 2010/04/07 21:33 UTC
Read the original article Hit count: 207

Filed under:
|

I have a number of reports that I run against my database that need to eventually go to the end-users as Excel spreadsheets.

Initially, I was creating text reports, but the steps to convert the text to a spreadsheet were a bit cumbersome. There were too many steps to import text to the spreadsheet, and multi-line text rows were imported as individual rows in Excel (which was incorrect).

Currently, I am generating simple XML saving the file with an ".xls" extension. This works better, but there is still the problem of Excel prompting the user with an XML import dialogue every time they open the file, and then having to save a new file if they add notes or change the layout to the file (which they almost certainly will be doing).

Sample "xls" file:

<?xml version="1.0" standalone="yes"?>             
<report_rows>                                      
  <row>                                            
    <NAME>Test Data</NAME> 
    <COUNT>345</COUNT>                 
  </row>
  <!-- many more row elements... -->
</report_rows>

Is there any way to add markup to the file to hint to Excel how it should import and handle the file? Ideally, the end user should be able to open and save the file like any othe spreadsheet they create directly from Excel.

Is this even possible?

UPDATE:

We are running Office 2003 here.

UPDATE:

The XML is generated from a sqlplus script, no option to use C#/.NET here.

© Stack Overflow or respective owner

Related posts about excel

Related posts about Xml