Create Excel SpreadsheetML in code. (Without Excel!)

With Excel 2003 and above, you can use the SpreadsheetML format to create Excel spreadsheets with only an XML stylesheet and an XML data file. I used this in some project and it works pretty well, although it is not easy to do. From the Microsoft download site, I downloaded the XSD that makes up SpreadsheetML, and in my ignorance I tried to convert them to C # classes. Unfortunately, xsd.exe is not very happy with these schema files, so I tend to get stuck. I do not need an alternative solution for SpreadsheetML, as it works fine for my needs. It's just that my code will be a little easier to maintain for my team members if it is not written in a complex style sheet. (It sucks to be the only XSLT expert in your company.)

All I want to know if someone has successfully created Excel SpreadsheetML files with .NET without using third-party code and without XSLT. And if you do, how did you decide?

(Or maybe I just need to learn how to add namespaces to XML elements in XML.Linq ...)

+3
source share
3 answers

Some time ago, I used XmlDocument and friends to create a SpreadsheetML document with formulas, formats, etc., so this is possible if a little unrealistic.

This MSDN page is what you need to start by using the namespace in LINQ.

+1
source
+1

I started with a similar problem a few weeks ago, but due to some impending problems I had to put it in the background.

Then I mentioned this http://www.codeproject.com/KB/aspnet/ExportClassLibrary.aspx?fid=113399&df=90&mpp=25&sort=Position&tid=2609600

I really could not start with this, but I plan to return to it soon. I hope this link helps.

amuses

0
source

Source: https://habr.com/ru/post/1709980/


All Articles