BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

WORD Page numbers

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
George Kuascha
Guest





PostPosted: Sat Sep 03, 2005 9:45 pm    Post subject: WORD Page numbers Reply with quote



I'm having a problem creating a format PAGE # of PAGENUMBERS in a footer. My
code is shown below. I'm trying to print in this format PAGE 1 OF 2. It
comes out PAGE OF center on one line and 12 left justified on the next line.
Can someone tell me what is wrong with this code?

Type_1:= wdFieldPage;
Type_2:= wdFieldNumPages;
Text:= '';
PreserveFormatting:= true;
WordDocument1.ActiveWindow.Selection.InsertParagraph;
FR:= WordDocument1.ActiveWindow.Selection.Range;
FR.Collapse(Direction);
WordDocument1.ActiveWindow.Selection.Paragraphs.Alignment:=
wdAlignParagraphCenter;
WordDocument1.ActiveWindow.Selection.TypeText('PAGE ');

WordDocument1.ActiveWindow.Selection.Fields.Add(FR,Type_2,Text,PreserveForma
tting);
WordDocument1.ActiveWindow.Selection.TypeText(' OF ');

WordDocument1.ActiveWindow.Selection.Fields.Add(FR,Type_1,Text,PreserveForma
tting);
WordDocument1.ActiveWindow.ActivePane.View.SeekView:= wdSeekMainDocument;


Back to top
George Kuascha
Guest





PostPosted: Sun Sep 04, 2005 1:28 pm    Post subject: Re: WORD Page numbers Reply with quote



I finally figured out that I needed to collapse before adding the fields.

"George Kuascha" <gkhokie (AT) hotmail (DOT) com> wrote

Quote:
I'm having a problem creating a format PAGE # of PAGENUMBERS in a footer.
My
code is shown below. I'm trying to print in this format PAGE 1 OF 2. It
comes out PAGE OF center on one line and 12 left justified on the next
line.
Can someone tell me what is wrong with this code?

Type_1:= wdFieldPage;
Type_2:= wdFieldNumPages;
Text:= '';
PreserveFormatting:= true;
WordDocument1.ActiveWindow.Selection.InsertParagraph;
FR:= WordDocument1.ActiveWindow.Selection.Range;
FR.Collapse(Direction);
WordDocument1.ActiveWindow.Selection.Paragraphs.Alignment:=
wdAlignParagraphCenter;
WordDocument1.ActiveWindow.Selection.TypeText('PAGE ');


WordDocument1.ActiveWindow.Selection.Fields.Add(FR,Type_2,Text,PreserveForma
tting);
WordDocument1.ActiveWindow.Selection.TypeText(' OF ');


WordDocument1.ActiveWindow.Selection.Fields.Add(FR,Type_1,Text,PreserveForma
tting);
WordDocument1.ActiveWindow.ActivePane.View.SeekView:=
wdSeekMainDocument;





Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.