C#NET2008 Using OPENXML transfer XML file data directly into EXCEL 2003

Joined
Nov 8, 2010
Messages
2
Reaction score
0
Hullo Good Guys,
happywave.gif


I am using c#NE2008, XML, Excel 2003.

I tried transfer XML file data directly into EXCEL 2003 using OPENXML it did does work but did not produced a proper Excel Column Header Text:

This is the coding:
xlWkBook = xlApp.Application.Workbooks.OpenXML(strXMLFile, oMissing, oMissing);



I need your help, please help me. Thank you. :)

Once I got the coding working based on your helps, I will post the coding here to share with other Newbies who may have similar problems.


Code:
 [/color]
[b][color=black]private void BtnExportExcel_Click(object sender, EventArgs e)[/color][/b]
 
[b][color=black]		{ //export directly from XML to Excel 2003[/color][/b]
 

 
[color=black]			string strXMLFile = @”F:\SalesDept\OrderXML.xml”;[/color]
 
[color=black]			object oMissing = System.Reflection.Missing.Value;						 [/color]
 
[color=black]										 [/color]
 
[color=black]			Excel.Application xlApp = new Excel.ApplicationClass();[/color]
 
[color=black]			Excel.Workbook xlWkBook;[/color]
 
[color=black]			Excel.Worksheet xlWksheet = null;[/color]
 
[color=black]			xlApp.Visible = true;[/color]
 

 
[color=black]		 xlWkBook = xlApp.Application.Workbooks.OpenXML(strXMLFile, oMissing, oMissing);							 [/color]
 
[color=black]	 }[/color]
 
[color=black]

-----------------------------------------------------------------



XML FILE DATA STRUCTURE













FRANK

10267

29/07/1996

26/08/1996

06/08/1996

208.58





FRANK

10337

24/10/1996

21/11/1996

29/10/1996

108.26









------------------------------------------------------------------------------



EXCEL 2003 SPREADSHEET RESULT



/table















/row/CustomerID

/row/Freight

/row/Freight/#agg

/row/OrderDate

/row/OrderID

/row/OrderID/#agg

/row/RequiredDate

/row/ShippedDate

FRANK

208.58

208.58

29/07/1996

10267

10267

26/08/1996

06/08/1996

FRANK

108.26

108.26

24/10/1996

10337

10337

21/11/1996

29/10/1996







Looking forward for your help. I am desperate to deliver the Application. Appreciate your help very much. Thank you.


Have a Good Day,
Cheers,
Lennie
 

Attachments

  • XMLEXCEL2003.doc
    33.5 KB · Views: 196
Top