Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
Old September 25th, 2010, 09: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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 04: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 03:50 PM



All times are GMT -4. The time now is 03:42 AM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.