Solved

Center the text or a picture using WordDocument

Posted on 2004-09-25
3
272 Views
Last Modified: 2010-04-05
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
Comment
Question by:bipbip86
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
mokule earned 125 total points
ID: 12151110
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
 

Author Comment

by:bipbip86
ID: 12152166
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
 

Author Comment

by:bipbip86
ID: 12152191
... the last line should be
          WordDocument.Tables.Item(i + 1).Cell(1, 1).VerticalAlignment:=wdCellAlignVerticalCenter;
my mistake.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Create a path if not exists 7 108
Tviruailstringtree sort multi columns on header click 1 86
Firemonkey BASS_Init into a thread 17 57
IP without any Dots 1 60
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question