Read text in Table in MS-Word

Q

quest

My word document has a table with two columns. How do I read the text in the
row and column of the table programatically ? Thanks.
 
C

Cindy M.

Hi Quest,
My word document has a table with two columns. How do I read the text in the
row and column of the table programatically ?
There are various approaches... It's not clear from your question whether you
want just text from a particular cell, or whether you're trying to pick up all
the table's text (to put into a database, perhaps)? Can you be more specific
about what you need to do?

And which programming language are you using?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
C

Cindy M.

Hi Quest,
I am using C#. I want to be able to read text in cells.
Getting text from Word is basically quite simple: Word.Range
range=document.Tables[1].Cell(1,1).Range; string text = range.Text;

Reading text from table cells is a bit tricky because a table cell's range
contains to extra characters at the end: Ansi 13 + Ansi 7 (=end-of-paragraph +
end-of-cell markers). What you need to do is trim these last two characters
off the string, using the string manipulation functions available in .NET,
once you've retrieved it.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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