Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
| Search | Today's Posts | Mark Forums Read
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 12th, 2010, 08:47 PM
Authorized User
Points: 97, Level: 1
Points: 97, Level: 1 Points: 97, Level: 1 Points: 97, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2010
Location: New Zealand
Posts: 18
Thanks: 0
Thanked 1 Time in 1 Post
Default Vb.Net 2003 problem Export XML file to Excel

Hi Friends,
Encounter another interesting problem.
Being ask to write script to transfer data from XML file to Excep and it's not working. Very Puzzle and desperate. Need your help.

This portion of scipt on compilation caused error:
xReader = XmlReader.Create("Order.xml", XMLReaderSettings)

Here are the script

Code:
Imports Excel = Microsoft.Office.Interop.Excel
Imports Word = Microsoft.Office.Interop.Word
Imports System.IO
Imports System.Xml
Imports System.Data
Imports System.Text

  Private Function FExportExcel()
        'export XML file data to Excel Spreadsheet

        Dim objExcel As Excel.Application
        Dim objWorkbook As Excel.Workbook
        Dim objWorkSheet As Excel.Worksheet
        Dim misValue As Object = System.Reflection.Missing.Value

        Dim DS As New DataSet
        Dim xReader As XmlReader
        Dim i, x As Integer

        objExcel = New Excel.Application
        objWorkbook = objExcel.Workbooks.Add(misValue)
        objWorkSheet = objExcel.Worksheets("sheet1")

        xReader = XmlReader.Create("Order.xml", XMLReaderSettings)
        DS.ReadXml(xReader)

        For i = 0 To (DS.Tables(0).Rows.Count - 1)
            For x = 0 To (DS.Tables(0).Columns.Count - 1)
                objWorkSheet.Cells(i + 1, x + 1) = DS.Tables(0).Rows(i).Item(i)
            Next
        Next

        objWorkSheet.SaveAs("xml2Excel.xls")
        objWorkbook.Close()
        objExcel.Quit()

        System.Runtime.InteropServices.Marshal.ReleaseComObject(objWorkSheet)
        System.Runtime.InteropServices.Marshal.ReleaseComObject(objWorkbook)
        System.Runtime.InteropServices.Marshal.ReleaseComObject(objExcel)

    End Function
__________________


Thank you very much.

Have a good day.

Cheers,
Lennie
 
Old September 25th, 2010, 08:51 PM
Authorized User
Points: 97, Level: 1
Points: 97, Level: 1 Points: 97, Level: 1 Points: 97, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2010
Location: New Zealand
Posts: 18
Thanks: 0
Thanked 1 Time in 1 Post
Default Vb.Net 2003 problem Export XML file to Excel

Quote:
Originally Posted by guser018 View Post
Hi
I don’t have so much idea regarding this subject. Just I suggest you to take steps accordingly. Hope you will understand.

__________
DR Software

Hullo guser108,
Regardng your suggestion as per Quotation what steps do you want me to take. I am very confused as there are no sample coding or written procedures.
__________________


Thank you very much.

Have a good day.

Cheers,
Lennie




Similar Threads
Thread Thread Starter Forum Replies Last Post
Export data to MS Excel in VB.NET DPARK0312 General .NET 1 December 9th, 2013 03:06 AM
Export DataGrid To Excel in vb.net jayakumar.cj ASP.NET 1.0 and 1.1 Basics 3 September 1st, 2010 03:09 AM
Vb.Net 2003 : How to Open and Read an XML File to TEXT File. Lennie VS.NET 2002/2003 0 February 12th, 2010 05:18 PM
Use function Solver of Excel in VB.NET 2003 pliroforikarios VB.NET 2002/2003 Basics 0 November 27th, 2005 03:37 PM
Learning VB in Excel: Is .Net 2003 an option? skinfreak VB.NET 2002/2003 Basics 3 April 27th, 2005 02:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.