Link to home
Start Free TrialLog in
Avatar of bipbip86
bipbip86

asked on

Center the text or a picture using WordDocument

I have one more question about  manipulating MS Word ... i want to make some text or a picture be  centered in a table cell .. or just in a Range somewhere. How can i do that?
ASKER CERTIFIED SOLUTION
Avatar of mokule
mokule
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bipbip86
bipbip86

ASKER

Well yes, i found out how to do it. Just in case someone else searches for it, to center the text in a table cell:

WordDocument.Tables.Item(1).Cell(1, 1).Range.Document.Paragraphs.Last.Alignment:=wdAlignParagraphCenter;

to center the content vertically:
WordDocument.Tables.Item(1).Cell(1, 1).VerticalAlignment;

well ,that's it.
 -bipbip.
... the last line should be
          WordDocument.Tables.Item(i + 1).Cell(1, 1).VerticalAlignment:=wdCellAlignVerticalCenter;
my mistake.