|
Problems and Solutions>Run-time Assembly |
|
|
FillPoints in headers and footers |
|
|
Article #: |
0003 |
|
Contributor: |
Daniel Todes |
|
GF version: |
3.05 |
|
Applies to: |
Headers and footers in Microsoft Word templates |
|
Last updated: |
June 4, 2001 |
Problem
FillPoints in headers and footers in a Word template (as opposed to an RTF Template) do not get filled.
Description
In Word, headers and footers are treated as a separate part of a document. When you fill a Word template, the GhostFill Word Desktop Client overlooks the contents of headers and footers. You can work around this by using Word Document Property fields in headers and footers and then setting the values for these fields from FillPoints in the template.
Solution
Click here to view a solution.
For example:
If you have the Word Document Property fields <ProjectName> in the header and <EffectiveDate> and <Version> in the footer, you would set the values as follows:
%[DocProperty.ProjectName='THE KNOWLEDGE BASE PROJECT']
%[DocProperty.EffectiveDate=FormatDate(ProjectDate,'mmmm,yyyy')]
%[DocProperty.Version=VersionNumber].
You then need to run the following script to update the headers and footers:
%[i=1;n=WordApp.ActiveDocument.Sections.Count]
%[RepeatBlockWhile(i<=n)]%[~x=WordApp.ActiveDocument.Sections(i).Headers(1).Range.Fields.Update();~x=WordApp.ActiveDocument.Sections(i).Footers(1).Range.Fields.Update();i=i+1]%[EndBlock]
It is advisable to store this code in a Clause. This way, you can access it from more than one template without repeating the script each time. Insert a FillPoint into the template to select the Clause that contains the script. For example:
%[Clauses.Select('\KB Project','Update Headers and Footers')].
|
NOTE |
|
You can insert FillPoints directly into headers and footers in an RTF templateor a Text template and they will be filled at run time. |
Template Example
Click here to view an example of this solution in a template.
|
{ DocProperty "Transfer"\ *MERGEFORMAT } { DocProperty "EffectiveDate"\ *MERGEFORMAT } |
|
%[Transfer=Dialogs.Select('\Demo\Transfer',''] %[DocProperty.Transfer=Transfer.Name&' - Transfer']%[DocProperty.EffectiveDate=FormatDate(Date(),'mmmm yyyy')]%[Clauses.Select('\KB', 'Update Headers and Footers')]
%[FormatDate(Transfer.Date, 'mmmm dd, yyyy')] %[Transfer.Name] %[Transfer.Address]
Dear %[Transfer.Name]
Property Transfer: %[Transfer.Property]
The amount of $%[Transfer.Amount] is owed by you for the above transfer. Please could you contact our offices at your earliest convenience to arrange payment.
Yours sincerely
P Anderson Attorney WILLOWMORE RUSKMAT & SMITH (Our Ref: PA/MB)
|
Click here to view a document generated from this template.
|
Janet Lee - Transfer August 2001 |
|
10 August 2001 Janet Lee 24 Albert Road Scottsville, New York USA 14546
Dear Janet Lee
Property Transfer: 32151
The amount of $15,000.00 is owed by you for the above transfer. Please could you contact our offices at your earliest convenience to arrange payment.
Yours sincerely
P Anderson Attorney WILLOWMORE RUSKMAT & SMITH (Our Ref: PA/MB) |