I have built a dynamic file in Ruby on Rails based in Spreadsheet XML that the user can download as an XLS file. One example of what the file content looks like is this:
<?xml version='1.0'?>
<Workbook xmlns='urn:schemas-microsoft-com:office:spreadsheet'
xmlns:o='urn:schemas-microsoft-com:office:office'
xmlns:x='urn:schemas-microsoft-com:office:excel'
xmlns:ss='urn:schemas-microsoft-com:office:spreadsheet'
xmlns:html='http://www.w3.org/TR/REC-html40'>
<ss:Styles>
<ss:Style ss:ID='header'><ss:Font ss:Bold='1'/><ss:Alignment ss:Horizontal='Center'/></ss:Style>
<ss:Style ss:ID='row'><ss:Alignment ss:Horizontal='Center' ss:Vertical='Center'/></ss:Style>
</ss:Styles>
<Worksheet ss:Name='Sheet1'>
<Table>
<Row ss:StyleID='header'>
<Cell><Data ss:Type='String'>Folder</Data></Cell>
<Cell><Data ss:Type='String'>Sub-Folder</Data></Cell>
<Cell><Data ss:Type='String'>Value</Data></Cell>
</Row>
<Row ss:StyleID='row'>
<Cell><Data ss:Type='String'>root</Data></Cell>
<Cell><Data ss:Type='String'>@defCode</Data></Cell>
<Cell><Data ss:Type='String'>433999</Data></Cell>
</Row>
</Table>
</Worksheet>
</Workbook>
Having the file extension be XLS allows the user to open it using any spreadsheet application such as OpenOffice, LibreOffice and, of course, Excel. Problem is that Excel doesn't open XLS files containing XML code without first complaining that the content and extention don't match. I don't want it to do that.
I have decided that I want to convert the XML I generate (I have it all in a big string) into legit XLS before sending it out to the user, but I have not been able to find any resources to do this. Ideally I would love a my_xml.to_xls type function but I'll take what I can get.