Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Create excel from xml file
Author:
Tanakorn
E-mail:
Click to e-mail author
Submitted:
6/29/2005
Version:
VB.NET 2003
Compatibility:
VB.NET 2003, VB.NET 2005
Category:
XML
Views:
88488
Create excel file from xml file.
Declarations:
Imports System.Xml Imports Microsoft.Office.Interop
Code:
Try Dim xml As New XmlDocument xml.Load("C:\bcptable.xml") Dim node As XmlNode Dim list As XmlNodeList list = xml.SelectNodes("//General") Dim app As New Microsoft.Office.Interop.Excel.Application Dim exbook As Microsoft.Office.Interop.Excel.Workbook Dim exsheet As Microsoft.Office.Interop.Excel.Worksheet exbook = app.Workbooks.Add exsheet = exbook.Sheets(1) Dim xx As Integer For Each node In list xx += 1 exsheet.Cells(xx, 1) = node.Attributes("File").Value exsheet.Cells(xx, 2) = node.Attributes("Table").Value Next exbook.SaveAs("C:\took1.xls") app.Visible = True MsgBox("complete") Exit Sub Catch ex As Exception MsgBox(ex.ToString) End Try
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2023 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement