Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I insert and modify a table in a Word document?

322 views
Skip to first unread message

Phil

unread,
Jul 19, 2005, 3:59:46 PM7/19/05
to
Can someone please provide the ActiveX commands that I can use in
Matlab to insert a table into a Word document. I am looking for
commands to create the table, specify the number of rows and columns,
adjust column widths, and put text into the cells of the table.

I have spent a lot of time searching in Google and in this newsgroup
and I can't seem to find this information anywhere. Please help!

Phil

unread,
Jul 20, 2005, 1:17:23 PM7/20/05
to
If anyone can help with this or point me to a website containing this
information, I would really appreciate it.

marc laetzel

unread,
Jul 21, 2005, 2:28:47 AM7/21/05
to

Hi,

just some starting ideas:

e = actxserver ('Word.Application');
wDocument = e.Documents.Add

%To insert a Table yuo need to specify the place where it should be
entered, to do so use a Range Object:

r=wDocument.Range(0,0) %Sets the Range to the beginning of the
document

wDocument.Tables.Add(r,3,4) % insert a 3 by 4 table

%in order to modify the table you have to use the table object
directly see e.g.

wDocument.Tables.Item(1).Style.get

As a source for using the commands
<http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbawd11/html/woobjTable1_HV05213695.asp>

might proove useful

Hope I could be of help

regards

Marc

Phil

unread,
Jul 28, 2005, 4:28:09 PM7/28/05
to

Marc, thanks so much for your help. I am still having trouble with
this though because it seems the syntax differs between what is on the
Microsoft website and what you put into Matlab. If you could help me
out with two additional things I would be very grateful.

Can you please give me an example of how I would write some text to a
cell (e.g., row 3, column 2). Also I would like to know how to change
the width of a column.

What would be better is if I could learn how to find the needed
commands at the Microsoft website and translate those into working
Matlab commands, but I can't seem to figure this out. Thanks for any
help you can provide.

Phil

unread,
Jul 29, 2005, 3:12:10 PM7/29/05
to


If anyone can help with this I would really appreciate it. Thanks.

us

unread,
Jul 29, 2005, 3:24:43 PM7/29/05
to
Phil:
<SNIP wants to create/populate a word table...

a more extended problem was solved in the days of yore at

<http://groups-beta.google.com/group/comp.soft-sys.matlab/tree/browse_frm/thread/ac82fd4c32a63d13/be4397ca450162f8?rnum=1&hl=en&q=peaks+word+us@neurol+group>:comp.soft-sys.matlab&_done=%2Fgroup%2Fcomp.soft-sys.matlab%2Fbrowse_frm%2Fthread%2Fac82fd4c32a63d13%2F514171133f6ab8e3%3Fq%3Dpeaks+word+us@neurol+group:comp.soft-sys.matlab%26rnum%3D6%26#doc_514171133f6ab8e3

us

Phil

unread,
Aug 3, 2005, 3:29:24 PM8/3/05
to


Thanks! I am finally starting to figure things out. I still don't
know how to resize a column, but I am working on it.

ghanam

unread,
Feb 16, 2016, 10:09:12 AM2/16/16
to
"marc laetzel" <marc....@donotuse.ica1.uni-stuttgart.de> wrote in message <ef0e...@webx.raydaftYaTP>...
Marc,
I want to insert a new Table in word document into a specific line of the document not at the begining or end of document ?
for example i have to insert a new table after an exesting table in the word document using a Range Object ?
any suggestions plz
0 new messages