Here's the code snippet that does the trick:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
/*
//Specify if we want headers and footers different for first, even and odd pages.
builder.PageSetup.DifferentFirstPageHeaderFooter = true;
builder.PageSetup.OddAndEvenPagesHeaderFooter = true;
*/
builder.PageSetup.HeaderDistance = 20;
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
string imageFileName = Application.StartupPath + "\\Aspose.Word.gif";
builder.InsertImage(imageFileName, RelativeHorizontalPosition.Page, 10, RelativeVerticalPosition.Page, 10, 50, 50, WrapType.Through, WrapSide.Both, false, null);
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.Write("ASPOSE.WORD DYNAMIC TEMPLATE");
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
builder.ParagraphFormat.Alignment = ParagraphAlignment.Right;
builder.InsertField("PAGE", "");
builder.Writeln("");
builder.ParagraphFormat.Alignment = ParagraphAlignment.Left;
builder.Writeln("(C) 2005 Aspose Pty Ltd. All rights reserved.");
doc.Save(Application.StartupPath + @"\DynamicDoc.doc");
Output results are in attachment.