Convert MS word doc table into structured xml using VB.NET


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 1 of 1

Thread: Convert MS word doc table into structured xml using VB.NET

  1. #1
    Join Date
    Nov 2005
    Posts
    2

    Question Capture Microsoft word table info using VB.NET

    I have a bunch of word documents with a small table on each some have two small tables. How would I use the word.Document object in Visual Basic.net to walk through these tables and save the info to a DataTable for instance. I have never worked with these Microsoft objects before and I can not really find anything on the net about them. I have taken a guess of a way to make it work but not to sure where to go from here or if I am even on the right track. This is what I am working on now

    Code:
    Private Function parseTable(ByVal doc As Word.Document) As DataTable
            Dim wordTable As DataTable
            Dim wordRow As DataRow
            Dim row As Integer = 0
            Dim column As Integer = 0
            For Each docTable As Word.Table In doc.Tables
                For Each docRow As Word.Row In doc.Tables
                    For Each docCell As Word.Cell In doc.Tables
                        'Somehow asign this cell to the correct position in the DataTable
                        column += 1
                    Next
                    row += 1
                Next
            Next        
        End Function
    Well am I way off??

    I was also thinking that this:
    Code:
    docTable.Tables(1).Cell(1, 1)
    might be useful for this perpose but again I could use few pointer.

    Any help is greatly appriciated.

    Thanks
    Chad
    Last edited by vega; 11-07-2005 at 05:04 PM.

Similar Threads

  1. query tuning
    By dhaya in forum Database
    Replies: 11
    Last Post: 08-25-2003, 05:24 PM
  2. XML files vs Database
    By Mansoor in forum XML
    Replies: 8
    Last Post: 08-23-2002, 04:35 PM
  3. How to convert XML to ADO Recordset
    By Amy in forum ASP.NET
    Replies: 1
    Last Post: 07-22-2002, 10:21 AM
  4. Multi-row calculations
    By Bob Hines in forum Database
    Replies: 7
    Last Post: 04-27-2000, 11:14 AM
  5. Replies: 1
    Last Post: 04-04-2000, 09:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center