在代码中创建Excel SpreadsheetML。 (没有Excel!) [英] Creating an Excel SpreadsheetML in code. (Without Excel!)

查看:320
本文介绍了在代码中创建Excel SpreadsheetML。 (没有Excel!)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Excel 2003及更高版本,可以使用SpreadsheetML格式生成只包含XML样式表和XML数据文件的Excel电子表格。我在一些项目中使用了这个工具,并且工作相当不错,即使这并不容易。
从Microsoft下载网站我已经下载了构成SpreadsheetML的XSD,在我的无知中,我已经尝试将它们转换为C#类。不幸的是,xsd.exe对这些模式文件不是很开心,所以我往往被卡住。
我不需要SpreadsheetML的替代解决方案,因为它适用于我的需要。只是我的代码对于我的团队成员来说会更容易维护,因为它不是写在一个复杂的样式表中。 (它吸引了您公司中唯一的XSLT专家。)

With Excel 2003 and higher it is possible to use the SpreadsheetML format to generate Excel spreadsheets with just an XML stylesheet and XML data file. I've used this in some project and works quite nice, even though it's not easy to do. From the Microsoft Download site I've downloaded the XSD's that make up SpreadsheetML and in my ignorance, I've tried to convert them to C# classes. Unfortunately, xsd.exe isn't very happy about these schema files so I tend to be stuck. I don't need an alternative solution to SpreadsheetML since it works fine for my needs. It's just that my code would be a bit easier to maintain for my team members if it's not written in a complex stylesheet. (It sucks to be the only XSLT expert in your company.)

所有我想知道如果有人已经使用.NET成功创建了Excel SpreadsheetML文件,而不使用第三个无需XSLT。如果你这样做,你是如何解决这个问题的?

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

(或者也许我只需要发现如何在XML.Linq中的XML元素中添加命名空间。 / p>

(Or maybe I just have to discover how to add namespaces to XML elements within XML.Linq...)

推荐答案

以前,我使用XmlDocument和朋友创建一个具有公式,格式等的SpreadsheetML文档,所以可能如果有点fiddly。

A while ago I used the XmlDocument and friends to create a SpreadsheetML document with formulae, formats and so on, so it is possible if a bit fiddly.

这个 MSDN页面是您需要开始使用LINQ中的命名空间。

This MSDN page is what you need to get started with using the namespace in LINQ.

这篇关于在代码中创建Excel SpreadsheetML。 (没有Excel!)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆