Fancy header/footer alignments, please help

M

Mike

Hi! I need to create Header and Footer programmatically in my Word 2003
document using C# or VBA.

The header should be like this:

On the Left side (left alligned) it should have a "DOCUMENT CATEGORY"
(passed as a parameter)
On the Right side (right alligned) it should have a "SPELLED OUT DATE"
(Monday November 21,2005) (passed as a parameter)

The footer should be like this:

On the Left side it should have a "CONFIDENTIAL"(passed as a parameter)
On the Right side (right alligned) it should have a "PAGE #" (passed as a
parameter)

So far I got this:
doc.Sections[1].Headers [Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text = "3 MONTHS REPORT";
This line creates a left-alligned entry in the header. But how can I insert
the date that's right-alligned ?

Thank you in advance,

--Michael
 
J

Jezebel

The easy way to do this is to pre-format the footer in your template using
DocProperty fields for the parameters you will be passing. (Insert dummy
values in the template, so you can get the formatting as you want it.) Then
from your code, set the document properties and update fields in the footer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top