View Single Post
  #2   Report Post  
Posted to microsoft.public.word.tables
Cindy M -WordMVP-
 
Posts: n/a
Default Create multiple stacked tables in word using vb.net

Hi ?B?SmVubnkgQmVhdmVycw==?=,

Hello everyone, I am glad I found you!

Well, still not *quite* the right place (an office.developer group would be
better; this group caters to end-users), but definitely a good place to start
:-)

Basically, you have to proceed like this:

1. Find the starting point (for the first table).

Note: you should be working with RANGES, not SELECTION objects.

2. Insert the first table, roughly:

Dim tbl As Word.Table = rng.Tables.Add 'Parameters here
'Populate and format the table

3. Now move the position outside the table, using a range
Dim rngTbl =tbl.Range
rngTbl.Collapse wdCollapseEnd
'This is just below the table
rngTbl.Text = "Text between the tables" & vbCR
rngTbl.Collapse wdCollapseEnd
tbl = Nothing
tbl = rngTbl.Tables.Add 'etc.

Here is what I am using:
Word ver 2002
OS XP
VB.Net

In vb.net I need to find a certain location in a Word template, then add
multiple tables fed from a dataset with a line in between each table
containing descriptive text. I have tried creating bookmarks on the fly and
adding a table to each bookmark without much success especially in where and
how they appear.
The tables need to be stacked so to speak on top of one another with a
descriptive line of text in between each table.
One of the main problems I have is in determining how to create the bookmark
locations to be one after the other(possibly with a space in between).
Maybe bookmarks are not the way to go.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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 :-)