Hi, I'm new to migraDoc and very pleased with the results I am getting so far.
I am creating a catalogue of concerts and want to have headers and footers like this:
- the headers should be different for the first and the other pages
(It should be empty at the start of a section and show the current artist's name otherwise)
- the footers should always have the page numbers, but on the left for odd and on the right side for even pages.
I can get one of the two to work, but not both.
here is a snippet, which will do it almost right:
Code:
currentSection = document.AddSection();
currentSection.PageSetup.DifferentFirstPageHeaderFooter = true;
currentSection.PageSetup.OddAndEvenPagesHeaderFooter = true;
currentSection.PageSetup.MirrorMargins = true;
Paragraph footer = currentSection.Footers.Primary.AddParagraph();
Paragraph footerE = currentSection.Footers.EvenPage.AddParagraph();
Paragraph footerF = currentSection.Footers.FirstPage.AddParagraph();
footer.AddPageField();
footerE.AddPageField(); footerE.Format.Alignment = ParagraphAlignment.Right;
footerF.AddPageField();
//if (???page is even???) footerF.Format.Alignment = ParagraphAlignment.Right;
Paragraph headerG = currentSection.Headers.FirstPage.AddParagraph();
headerG.Add(writeFText(genre + " ", 9, ""));
Paragraph header = currentSection.Headers.Primary.AddParagraph();
header.Add(writeFText(genre + " ", 9, ""));
header.Add(writeFText(" " + artist,10, "B"));
however the footerF will always be aligned left.
managing the left(right changes by hand does not seem right, as this is the renderer's job right?
and leaving out the FooterF completely will not have a page number on each section's first page.
Thanks in advance for any hints!
Thomas Wulf