table parser

C

carlos

I have a table in a Word document.
I wanna write a parser in java to get the data in each field of the table.
But I found that it is difficult.
So I wonder if there is a way in vba to do this.

My intention is to get the data and write them in a xml file.
If it is difficult, writing to a text file is also acceptable.

Anyone have exp in this? Thanks.
 
D

Doug Robbins

Dim myrange As Range, i As Long, j As Long, mytable As Table
Set mytable = ActiveDocument.Tables(1)
For i = 1 To mytable.Rows.Count
For j = 1 To mytable.Columns.Count
Set myrange = mytable.Cell(i, j).Range
myrange.End = myrange.End - 1
'do what you want to with myrange which will now contain
'the contents of the cell.
Next j
Next i


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top