简体   繁体   English

使用C#中的ExcelPackage将XML文件导入到具有现有地图的excel中

[英]Import XML file to excel with existing map using ExcelPackage in C#

How can I import xml file to existing excel template. 如何将xml文件导入现有的excel模板。 I have a map (xsd). 我有一张地图(xsd)。

It has to be done on server. 它必须在服务器上完成。 I used excelPackage , but couldnt find any documentation for the classes. 我使用excelPackage,但是找不到有关这些类的任何文档。

More specific question: how do I write in C# the following code from VB.NET 更具体的问题:如何用C#从VB.NET编写以下代码

Dim xmlSchema As String = "c:\Schema1.xsd" 
Map = XL.ActiveWorkbook.XmlMaps.Add(xmlSchema) 
Wb.XmlImportXml(xmlStr, oMap) 

There is extensive documentation and tutorials and everything on the Codeplex site for ExcelPackage: 在Excel的Codeplex网站上有大量的文档和教程以及所有内容:

http://excelpackage.codeplex.com/ http://excelpackage.codeplex.com/

As for your question: 至于你的问题:

  • if you have a XSD file, you can easily deserialize your XML file into an object graph 如果您有XSD文件,则可以轻松地将XML文件反序列化为对象图
  • parse the objects as needed and insert the relevant information into a new Excel sheet based on your template 根据需要解析对象,然后根据您的模板将相关信息插入新的Excel工作表中

Your question is way too broad and not specific enough to be able to help with it - you'll need to make your question more specific and provide more information! 您的问题过于笼统,不够具体,无法为您提供帮助-您需要使问题更加具体,并提供更多信息!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM