tags:

views:

26

answers:

2

My client needs to read some queries using Excel or something like it, so I need to generate XLS calling in some queries in stored procedures.

Basically I have the SP, I have the View Done, and the query working fine, but I don't know how to make an xls or an xlsx with the SP itself.

Is there any good practice or some specific steps I should follow?

Working with .NET C# and MVC2.

Thank you in advance!

A: 

I would rather try and create XMLSS, still not very easy with an SP but with less issues than trying to create XLS or XLSX.

Lucero
A: 

Write the data as an HTML document and serve it up as a .XLS file rather than .HTML.

All versions of Excel 2003 or higher will accept an HTML file, just as if it was .XLS binary or OpenOfficeXML. The users won't see the difference.

Demo: Copy this into Notepad

<html><body><table>
<tr><td>name</td><td>age</td></tr>
<tr><td>Albert</td><td>21</td></tr>
<tr><td>Brian</td><td>47</td></tr>
<tr><td>Charles</td><td>32</td></tr>
</table></body></html>

Save As "simple.XLS".

Open that with Excel.

smirkingman