0

I'd like to transform my XMLDocument containing what you'd call simple xml content into an xls file, possibly using XSLT (judging from what I've found so far) to transform the data, and I'd like the save the created file as an xls file to be opened with Excel whilst not being able to use Excel in the process of creating this file (thus being unable to use MS.Office.Interop.Excel from what I've heard). How exactly would I do this and which classes would I utilize to create this document?

Any help on this one would be greatly appreciated!

Thanks,

Dennis

3 Answers 3

2

Probably your best bet is NPOI, a .NET port of the Apache POI library.

Sign up to request clarification or add additional context in comments.

1 Comment

Excellent suggestion, this is really easy to get into!
1

You can't use XSLT to create a XLS file, because XLS is a binary format.
If you are talking about ExcelML, this can be done. If you want to do it by hand, I think the best way to start is the following: Create an ExcelML file using Excel that looks like what you need. Open this file in a text editor and analyse it. Additionally, you should download the reference of the format (Open Help -> OfficeXMLSDK.chm).

2 Comments

Well ... now that's kind of disappointing. IS there any way to transform data stored in XML (or any way that you can create using XML Data) to an XLS format? Thanks!
Thanks, this is also a good suggestions, using NPOI seems a bit more straight-forward to me though.
0

There are 3 wasy to convert XML to Excel XLS.
- If the XLS file layout is simple, just transform your XML to an HTML table, and load in Excel (either from a disk file, or HTTP response). This works for many cases, however beware that column / row spanning really confuses Excel.
- If you have a complex layout, with lots of formatting / worksheets, jump into the OfficeXMLSDK, it's pretty hairy with tons of namespaces - If you have Excel on the server, create a template document in Excel, and use the Excel.Interop

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.