How do I parse a Word document with a programming language?

T

TommyX

How I really want to do is find a table in a word document and put the fields
into an Excel spreadsheet. Perl would be nice to use since I am trying to
learn that language, but C, C++, TCL or VB.NET will work.
 
H

Helmut Weber

Hi Tommy,
without using word, which would not be much of a drawback,
I'd say, not at all. Otherwise, you must be on equal terms with MS,
financially, or you are a real genius.
Any of the languages you mention, should be able to create
a reference to word and use a word object from then on.
By the way, what a table is made off, are cells!
These may contain fields of every kind, but I guess,
that is not what you are thinking of.
 
T

TommyX

I've been an embedded programmer for a long time, but am pretty new to
Microsoft stuff. Where do I start reading about accessing word objects.
What I want to do is open a Word doc scan for a table, then grab the first
cells content in each row. The would be for these documents the requirements
identifier. Then eventually put that into a Excel documents first row in
groups per Word documents tables. For a newcomer that is a big task.

Where do I start reading about Word objects? And am I asking the right
questions?

TommyX
 
H

Helmut Weber

Hi Tommy,
no problem with your questions. Some problems with the answers.
What you have to find out is, how to get a reference to
Word from your programming language.
Differences aren't overwhelming, as far as I know.
From Excel it would look like this, untested:
dim oWrd as word.application
set oWrd = new Word.application
Form c# or c++ or whatever, it might look a bit different.
From then on it is plain sailing. Once you got the reference,
I'd say, try oWrd.activedocument.selection.typetext text:= "ttt".
If you can manage that, then you have arrived.
From then on, all the MVPs here and many others could
provide you with most of what you need, hopefully.
 

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