Der folgende Code zielt darauf ab, einen Bild- und Datumsstempel zum Seitenkopf hinzuzufügen und dann die Seite mit etwas Text (zum Beispiel eine Überschrift und ein paar Absätze) zu füllen .Absätze nach unten drücken, um nicht mit Seitenkopf in MigraDoc 1.5b3 zu überlappen
Das Problem besteht darin, dass der Text den Seitenkopf überlappt, er beginnt auf derselben Höhe wie der Absatz des Datumsstempels im Seitenkopf. Was mache ich falsch?
Section section = document.AddSection();
section.PageSetup.StartingNumber = 1;
Image image = section.Headers.Primary.AddImage(GetImageFromDB("LogoPageHeader")); // creates base64 encoded image string
image.LockAspectRatio = true;
image.RelativeVertical = RelativeVertical.Line;
image.RelativeHorizontal = RelativeHorizontal.Margin;
image.Top = ShapePosition.Top;
image.Left = ShapePosition.Left;
image.WrapFormat.Style = WrapStyle.TopBottom; // to push date stamp to below the bottom of the image
HeaderFooter header = section.Headers.Primary;
Paragraph paragraph = header.AddParagraph(DateTime.Now.ToString("MM/dd/yyyy"));
paragraph.Format.Alignment = ParagraphAlignment.Right;
Paragraph paragraph = document.LastSection.AddParagraph("Question Summary:", "Heading3");
paragraph = document.LastSection.AddParagraph();
paragraph.Format.Alignment = ParagraphAlignment.Left;
paragraph.AddText("Question: " + q.Text.Trim());
paragraph = document.LastSection.AddParagraph();
paragraph.Format.Alignment = ParagraphAlignment.Left;
paragraph.AddText("Answer: " + (String.IsNullOrEmpty(q.ReplyText.Trim()) ? q.ReplyCode.ToString() : q.ReplyText.Trim()));
paragraph.Format.SpaceAfter = "8pt";
Das Bild ist etwa 20x20mm.
einfach den verknüpften Code zu erhalten: 'section.PageSetup.BottomMargin = Unit.FromCentimeter (x)' – ajeh