简体   繁体   中英

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

How can I import xml file to existing excel template. I have a map (xsd).

It has to be done on server. I used excelPackage , but couldnt find any documentation for the classes.

More specific question: how do I write in C# the following code from 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:

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
  • parse the objects as needed and insert the relevant information into a new Excel sheet based on your template

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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