简体   繁体   English

如何从 Excel 电子表格创建一个 .xslt 文件?

[英]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.

相关问题 您如何根据列值从 excel 电子表格中 select 行并将其插入 dataGridViews? - How do you select rows from an excel spreadsheet based off of a column value and insert it into dataGridViews? 如何从Excel电子表格中读取单个列? - How do I read in a single column from an Excel spreadsheet? 如何使用OleDbDataAdapter从Excel文件中的任何电子表格中进行选择 - How to SELECT from any spreadsheet in Excel File using OleDbDataAdapter 如何从SSL密钥文件创建RsaSecurityKey实例 - How do you create an instance of RsaSecurityKey from a SSL key file 如何通过链接而不是图像文件通过Spreadsheet Light将图片插入Excel电子表格? - How can I insert a picture into an Excel spreadsheet with Spreadsheet Light from a link rather than an image file? 如何在每个行的Excel电子表格中向单元格添加表单控件 - How do you add a forms controls to a cell in a Excel spreadsheet for each row 如何向通过 oledb 在 excel 电子表格上运行的计数查询添加参数? - How do you add parameters to a count query ran on an excel spreadsheet via oledb? 如何使用Npoi数据集创建Excel电子表格 - How to create an excel spreadsheet using a dataset with Npoi 如何验证文件是否是有效的Excel电子表格? - How to verify if a file is a valid excel spreadsheet? 如何使用C#中安装的Excel外接程序创建Excel电子表格? - How to create an excel spreadsheet with an excel add-in installed in c#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM