 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Richard Guest
|
Posted: Sat Apr 14, 2007 7:57 am Post subject: Word and adding borders programmatically |
|
|
Hi,
I am using D6 with sp2, XP and SP2 and Word 2002.
I have done the Word macro bit and have converted the VB macro code into
pascal to set a border round each page in a Word document. I want the border
to be anchored to the edge of the page not the text, which is the
DistanceFrom property. There are two options, wdBorderDistanceFromText and
wdBorderDistanceFromPageEdge, but regardless of which I choose it always
anchors the borders to the text. In standalone Word it behaves properly when
I make the appropriate selection.
This is the code:
worddocument1.Paragraphs.Format.Borders.item(wdBorderLeft).LineStyle :=
wdLineStyleSingle;
worddocument1.Paragraphs.Format.Borders.Item(wdBorderLeft).LineWidth :=
wdLineWidth050pt;
worddocument1.Paragraphs.Format.Borders.Item(wdBorderLeft).Color :=
wdColorAutomatic;
[repeats for the other 3 edges]
worddocument1.Paragraphs.Format.Borders.DistanceFrom :=
wdBorderDistanceFromPageEdge; // problem line
worddocument1.Paragraphs.Format.Borders.AlwaysInFront := True;// the rest
of this seems to work ok
worddocument1.Paragraphs.Format.Borders.SurroundHeader := True;
worddocument1.Paragraphs.Format.Borders.SurroundFooter := True;
worddocument1.Paragraphs.Format.Borders.JoinBorders := False;
worddocument1.Paragraphs.Format.Borders.DistanceFromTop := 24;
worddocument1.Paragraphs.Format.Borders.DistanceFromLeft := 24;
worddocument1.Paragraphs.Format.Borders.DistanceFromBottom := 24;
worddocument1.Paragraphs.Format.Borders.DistanceFromRight := 24;
worddocument1.Paragraphs.Format.Borders.Shadow := true;
worddocument1.Paragraphs.Format.Borders.EnableFirstPageInSection := True;
worddocument1.Paragraphs.Format.Borders.EnableOtherPagesInSection := True;
worddocument1.Paragraphs.Format.Borders.ApplyPageBordersToAllSections;
Has anyone else come across this one, or got a workround?
Any help greatly appreciated
Richard |
|
| Back to top |
|
 |
Oliver Townshend Guest
|
Posted: Wed Apr 18, 2007 8:12 am Post subject: Re: Word and adding borders programmatically |
|
|
| Quote: | Has anyone else come across this one, or got a workround?
Any help greatly appreciated
|
Sometimes when a feature doesn't work in Delphi but does work in Word it
pays to use OleVariants, which are a bit slower.
Oliver Townshend |
|
| Back to top |
|
 |
|
|
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
|
|