Click here to Skip to main content
14,735,318 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

I have a problem in my project. I need to take XML file and show the data in EXCEL Sheet.

Here is my XML file to convert into Excel.

<Header>
  <SenderID>C001</SenderID>
  <ReceiverID>MF469</ReceiverID>
  <TransactionDate>14/06/2011 19:55</TransactionDate>
  <RecordCount>1</RecordCount>
  <DispositionFlag>PRODUCTION</DispositionFlag>
</Header>

<Claim>
  <ID>7733</ID>
  <IDPayer>344564-1-9</IDPayer>
  <ProviderID>MF469</ProviderID>
  <PaymentReference>42850/4</PaymentReference>
  <DateSettlement>23/05/2011 00:00</DateSettlement>
  <Encounter>
    <FacilityID>MF469</FacilityID>
  </Encounter>
  <Activity>
    <ID>1</ID>
    <Start>13/10/2010 12:00</Start>
    <Type>8</Type>
    <Code>10</Code>
    <Quantity>1</Quantity>
    <Net>70</Net>
    <List>70</List>
  </Activity>
</Claim>



Please help me out ASAP.
Posted
Updated 12-Jul-17 7:09am

   
Comments
_Amy 13-Jul-12 6:55am
   
Nice links.! +5!
Raje_ 13-Jul-12 7:11am
   
Dhanyabad mahashay.
Hi,
Here you go:
#1 example (converting XML into XLS):
--------------------
private static void SampleXMLtoXLSConversion()
{
    // read XML and convert into XLS (Excel) and save
    XLSDocument document = new XLSDocument();
    SimpleXMLConverter tools = new SimpleXMLConverter(document);
    tools.LoadXML("AdvancedReport.xml");
    File.Delete("AdvancedReportFromXML.xls");
    document.SaveAs("AdvancedReportFromXML.xls");
    document.Close();
}

#2 example (converting XLS into XML):
--------------------
private static void SampleXLStoXMLConversion(){
    XLSDocument document;
    // read XLS and save as XML
    document = new XLSDocument("AdvancedReport.xls");
    SimpleXMLConverter tools = new SimpleXMLConverter(document);
    tools.SaveXML("AdvancedReport.xml");
    document.Close();
}

These are the simple example for converting XML to excel.

All the best.
--Amit
   
Comments
[no name] 13-Jul-12 11:44am
   
You need to provided references if you are going to post code snippets that contain non-native .NET classes. https://bytescout.com/support/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=83&nav=0,1,17

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900