[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

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?
0
bipbip86
Asked:
bipbip86
  • 2
1 Solution
 
mokuleCommented:
Hi,
The best practice in all such situations is to create new macro.
Do needed operations. Look into the macro. Do the same in Delphi.
0
 
bipbip86Author Commented:
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.
0
 
bipbip86Author Commented:
... the last line should be
          WordDocument.Tables.Item(i + 1).Cell(1, 1).VerticalAlignment:=wdCellAlignVerticalCenter;
my mistake.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now