[Webinar] Learn how to a build a cloud-first strategyRegister Now


Add footer do migradoc document

Posted on 2011-10-14
Medium Priority
Last Modified: 2013-12-16

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

Question by:andre72
  • 3
  • 2
LVL 14

Assisted Solution

by:Daniel Junges
Daniel Junges earned 2000 total points
ID: 36968242

Author Comment

ID: 36981214
I think this work only for word and does not matter for MigraDoc ...
LVL 14

Assisted Solution

by:Daniel Junges
Daniel Junges earned 2000 total points
ID: 36981900
ohh sorry, was my mistake...

i searched and found this http://www.java2s.com/Open-Source/CSharp/PDF/PDFsharp/MigraDoc/RtfRendering/HeaderFooterRenderer.cs.htm

may be this help you.

i work only with msword and broffice and not familiar with MigraDoc

Accepted Solution

andre72 earned 0 total points
ID: 37113108
I've given up ...

Author Closing Comment

ID: 37136664
Seems that not so much EE use MigraDoc ...

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question