Setting left indent of Word.Table

G

Garrold

Hi all, hope someone can help with this.

I'm doing a mail merge with some data from a database and a word
document template. I'm replacing bookmarks in the template with the
data. The whole document template is set with a left indent of 0.5cm,
but when I add a table to the document, the indent gets ignored. I've
tried adding

Word.Table oTable;
Word.Range wrdRange;

(WordDocument is part of my base class, representing the
Microsoft.Office.Interop.Word.Document)

wrdRange = WordDocument.Bookmarks.get_Item(ref oBookmark).Range;
oTable = WordDocument.Tables.Add(wrdRange, intRows, 5, ref oMissing,
ref oMissing);
oTable.Range.ParagraphFormat.LeftIndent = 0.5F;

but this does not fix the problem.

Any ideas?

Many thanks

Gaz
 
C

Cindy M.

Hi Garrold,

oTable.Rows.LeftIndent = CentimetersToPoints(0.5)

The table "measures" from the margin and doesn't "look" at paragraph
indenting. If the entire document has this indent, why not change the
margin?
I'm doing a mail merge with some data from a database and a word
document template. I'm replacing bookmarks in the template with the
data. The whole document template is set with a left indent of 0.5cm,
but when I add a table to the document, the indent gets ignored. I've
tried adding

Word.Table oTable;
Word.Range wrdRange;

(WordDocument is part of my base class, representing the
Microsoft.Office.Interop.Word.Document)

wrdRange = WordDocument.Bookmarks.get_Item(ref oBookmark).Range;
oTable = WordDocument.Tables.Add(wrdRange, intRows, 5, ref oMissing,
ref oMissing);
oTable.Range.ParagraphFormat.LeftIndent = 0.5F;

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 :)
 
G

Garrold

Hi Cindy,

Thanks for the tip, I was just about to write an update to say I'd
found the problem, thanks anyway!

Gaz
 

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