Table Questions

K

Ken Hutson

Hi Group,

I am looping through the paragraphs collection in my document. When I
encounter a paragraph that resides in a table;

First of all, where do I look to determine if the paragraph is inside a
table?

I am also interested in knowing how to find distances, especially from;
left margin to the cell left border.
right margin to the cell right border.
top margin to the cell top border.
bottom margin to the bottom cell border.
Where can I find these values?

Thanks,
Ken Hutson
San Antonio, TX
 
S

Stephanie Krieger

Hi, Ken,

First -- you can use Selection.Information to determine
if your insertion point is in a table (wdWithinTable is
one of the available constants):

If Selection.Information(wdWithinTable) = True Then ...

To find the cell margins programmatically -- the
properties (of either a specified item in the Tables or
Cells collection objects) are called:

TopPadding
BottomPadding
LeftPadding
RightPadding

i.e....

Selection.Tables(1).TopPadding

Will return the top margin value for all cells in the
first table in your selection (note that the Tables
collection object can be used with either the Selection
or ActiveDocument objects).

You can find the cell margins in the U.I. through Table,
Table Properties -- click Options on the Table tab to see
or change the settings for the whole table. Click Options
on the Cell tab to see or set unique settings for only
the active or selected cells.

Hope that helps.

Stephanie Krieger
author of Microsoft Office Document Designer (from
Microsoft Press)
email: MODD_2003 at msn dot com
blog: arouet.net
 
K

Ken Hutson

Hi Stephanie,

I saw cell padding earlier but I'm hoping I can find how far the borders are
fom the document margins.
Keep a running total of column widths?

Thanks,
Ken Hutson
San Antonio, TX
 
S

Stephanie Krieger

Hi, Ken,

The borders, if they're cell or table borders, are always
on the cell frame itself. So, the distance between the
border and the available space in the cell is the cell
padding.

I suspect, though, that you might be asking about
something else ... so if that doesn't answer your
question, feel free to email me a sample of what you're
working on ... or even email more info.

I'm logging off right now and won't be back on newsgroups
this week -- but I will be checking my email.

Best,
Stephanie
email: MODD_2003 at msn dot com
 
K

Ken Hutson

Hi Stephanie,

Essentially, I am translating Word information to a computer aided design
application. Process should not require any user interaction except the
user designated filenames.

To create any paragraph or line in my cad program, I need to provide (x,y)
coordinates. By looping through the paragraphs collection I have made
pretty good progress. Document left and right margins were providing a
convenient x-axis reference for paragraph text. For example, if paragraph
was left justified and left indent was 36, I just set my x coordinate =
pointtoinches(36). I keep track of the y-coordinate another way.

However some paragraphs are inside tables. First, (and probably most
important) I need to be able to detect if a paragraph is inside a table. To
draw a visible cell border, I need (x,y) coordinates for each endpoint of
the line. Since document margins were a reliable reference up to this
point, I hope to continuing using them.

Cheers,
Ken Hutson
San Antonio, TX
 

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