Add footer do migradoc document


I need to create a document with simple table.
That works fine at all but I like to have a footer there counting the pages, eg.
Page X of Y ...

For the samples I found it looks very simple:
Add a footer and the content for to a section - but my footer will never been shown ...

Any idea what's wrong here?



public class Invoice
    Document document;
    Table table;
    Section section;

    TextMeasurement tm;

    public Invoice()

    public Document CreateDocument(DataTable dt)
        this.document = new Document();
        this.document.Info.Title = "Rechnung";
        this.document.Info.Subject = "";
        this.document.Info.Author = "";

        return this.document;

    void DefineStyles()
        Style style;

        style = this.document.Styles["Normal"];
        style.Font.Name = "Arial";
        style.Font.Size = 7;

        style = this.document.Styles[StyleNames.Footer];
        style.ParagraphFormat.AddTabStop("8cm", TabAlignment.Center);
        style = this.document.Styles.AddStyle("Table", "Normal");
        style.Font.Name = "Arial";
        style.Font.Size = 7;


    void CreatePage()

        section = this.document.AddSection();

        // Create footer
        Paragraph paragraph = section.Footers.Primary.AddParagraph();
        paragraph.AddText("PowerBooks Inc · Sample Street 42 · 56789 Cologne · Germany");
        paragraph.Format.Font.Size = 9;
        paragraph.Format.Alignment = ParagraphAlignment.Center;


Open in new window

Who is Participating?
andre72Author Commented:
I've given up ...
andre72Author Commented:
I think this work only for word and does not matter for MigraDoc ...
Daniel JungesCommented:
ohh sorry, was my mistake...

i searched and found this

may be this help you.

i work only with msword and broffice and not familiar with MigraDoc
andre72Author Commented:
Seems that not so much EE use MigraDoc ...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.