[英]How do you create an .xslt file from an Excel spreadsheet?
I'm working on a C#
application that is going to save a DataSet to an Excel file.我正在开发一个C#
应用程序,它将数据集保存到 Excel 文件中。
I have found several examples of how to do this, but they all require you to have an xslt style sheet.我找到了几个如何执行此操作的示例,但它们都要求您拥有xslt 样式表。 I already have an existing Excel spreadsheet with all the worksheets and columns created.我已经有一个现有的 Excel 电子表格,其中创建了所有工作表和列。 Is there an easy way to create an .xslt
file from my existing Excel spreadsheet?有没有一种简单的方法可以从我现有的 Excel 电子表格创建.xslt
文件?
An example . 一个例子。
First of all, your question is really confusing and hard to understand.首先,您的问题确实令人困惑且难以理解。 You might want to rewrite it to be a bit more specific.您可能希望将其重写为更具体一点。 If you really have two or three questions, then ask each one on a separate page.如果您确实有两三个问题,请在单独的页面上询问每个问题。
Step 1. You said that you have an Excel file.第 1 步。您说您有一个 Excel 文件。 Open it up in a text editor and look at it.在文本编辑器中打开它并查看它。 If it is in XML format, then the XSL that you need should be obvious because your job is to convert the existing XML dataset into the Excel XML format. If it is in XML format, then the XSL that you need should be obvious because your job is to convert the existing XML dataset into the Excel XML format.
Step 2. XSL Templates are not magic.步骤 2. XSL 模板并不神奇。 They are actually a form of programming language that is executed by an XLST engine.它们实际上是一种由 XLST 引擎执行的编程语言。 Of course it is possible to write a program that can compare two XML formats and generate an XSL template that would transform one into another, but that would be a very complex program and it would probably have some rigid requirements on the type of XML files that it would work with.当然,可以编写一个程序来比较两种 XML 格式并生成一个 XSL 模板,将其转换为另一种格式,但这将是一个非常复杂的程序,它可能对 XML 文件的类型有一些严格的要求它可以使用。 I doubt that anyone has created such a tool that you can leverage.我怀疑是否有人创造了这样一个你可以利用的工具。
Step 3. Get a decent tool that allows you to apply an XSL template to your dataset so that you can test it without a lot of work.步骤 3. 获得一个不错的工具,允许您将 XSL 模板应用到您的数据集,这样您就可以在不做大量工作的情况下对其进行测试。 Personally I use Netbeans with an XML Debug plugin, but there are numerous other tools out there.我个人使用 Netbeans 和 XML 调试插件,但还有许多其他工具。 In fact, you could just write a simple transform tool yourself that just runs the XSLT on a sample dataset and then opens it up in both Excel and a text editor.事实上,您可以自己编写一个简单的转换工具,在示例数据集上运行 XSLT,然后在Excel 和文本编辑器中打开它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.