MigraDoc을 사용하여 PDF를 만들고 있는데 첫 페이지와 첫 번째 페이지에 바닥 글이 있고 나머지 모든 페이지 (첫 번째 페이지는 제외)에 머리말이 있어야합니다. 나는 DifferentFirstPageHeaderFooter
으로 실험했으나 필요한 결과를 얻지 못했습니다. 해당 설정과 머리글과 바닥 글을 추가 할 수있는 적절한 조합이 있다는 것을 알고 있지만 무엇이 있는지 모르겠습니다. 나는 MigraDoc 청구서 샘플에 기초를두고 있습니다. 표지는 섹션이며 나머지 문서는 페이지 나누기가있는 섹션입니다. 페이지 당 하나의 섹션으로 나눌 필요가 있을까요? 모든 팁 주셔서 감사.MigraDoc 머리말과 꼬리
편집
내가 보여 헤더를 얻었으나, 내가 뭘하는지보다 그것을 할 수있는 더 좋은 방법이처럼 보인다. 꼬리말이 전혀 나타나지 않습니다. 여기에 내가 그들을 추가 해요 어디 :
Document document = new Document();
Section section = document.AddSection();
section.PageSetup.DifferentFirstPageHeaderFooter = true;
Paragraph paragraph = section.Footers.Primary.AddParagraph();
paragraph.AddFormattedText(ReportName, TextFormat.Bold);
paragraph.AddText("\nCreated on ");
paragraph.AddFormattedText(CreateDate, TextFormat.Bold);
paragraph.AddFormattedText("\n" + Properties.Length, TextFormat.Bold);
paragraph.AddText(" Records");
paragraph.AddFormattedText("\n" + TurnoverPercent, TextFormat.Bold);
paragraph.AddText(" Turnover Rate");
paragraph.Format.Font.Size = 10;
paragraph.Format.Alignment = ParagraphAlignment.Center;
// Later, in a different method...
Section section = document.AddSection();
// Header image
Image image = section.Headers.Primary.AddImage(filename);
image.Height = "2.5cm";
image.LockAspectRatio = true;
image.RelativeVertical = RelativeVertical.Line;
image.RelativeHorizontal = RelativeHorizontal.Margin;
image.Top = ShapePosition.Top;
image.Left = ShapePosition.Right;
image.WrapFormat.Style = WrapStyle.Through;
image = section.Headers.FirstPage.AddImage(filename);
image.Height = "2.5cm";
image.LockAspectRatio = true;
image.RelativeVertical = RelativeVertical.Line;
image.RelativeHorizontal = RelativeHorizontal.Margin;
image.Top = ShapePosition.Top;
image.Left = ShapePosition.Right;
image.WrapFormat.Style = WrapStyle.Through;
나는 차 및 FirstPage에 바닥 글 단락을 추가 시도하고 변화를 보이지 않았다. DifferentFirstPageHeaderFooter
은 전체 문서가 아닌 섹션에만 적용됩니까?
왜 downvote입니까? – nasch
FirstPage 헤더는 첫 번째 페이지에서 사용됩니다. 귀하의 경우 Primary 헤더는 다른 모든 페이지에서 사용됩니다. 둘 다 설정하면 모든 페이지에 헤더가 생깁니다. 1.50 베타 버전을 사용하고 있습니까? 아니면 이전 버전입니까? –
음, 알아 냈습니다. 'DifferentFirstPageHeaderFooter'는 설정 한 섹션에만 적용되는 것이 아니라 모든 섹션에 적용되는 것으로 보입니다. 일단 각 섹션에서 적절하게 설정하면 문제가 모두 해결되고 머리말과 꼬리말이 내가 원하는 곳에 나타납니다. – nasch