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
Well am I way off??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![]()
I was also thinking that this:might be useful for this perpose but again I could use few pointer.Code:docTable.Tables(1).Cell(1, 1)
Any help is greatly appriciated.
Thanks
Chad


Reply With Quote


Bookmarks