Link to home
Start Free TrialLog in
Avatar of andre72
andre72

asked on

Add footer do migradoc document

Hi,

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?

Thanks

Andre

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 = "";

        DefineStyles();
        CreatePage();
        FillData(dt);
        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

SOLUTION
Avatar of Daniel Junges
Daniel Junges
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of andre72
andre72

ASKER

I think this work only for word and does not matter for MigraDoc ...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of andre72

ASKER

Seems that not so much EE use MigraDoc ...