| PDFsharp & MigraDoc Forum https://forum.pdfsharp.net/ |
|
| Footer Formatting Issues https://forum.pdfsharp.net/viewtopic.php?f=2&t=2518 |
Page 1 of 1 |
| Author: | a.harper [ Tue Jul 16, 2013 2:14 pm ] |
| Post subject: | Footer Formatting Issues |
Hi, I am trying to duplicate a report that is generated in Word. I have got everything working correctly, except for the footer. I have the footer looking correctly, except it is exactly 1 cm too high. Here is the code I am running. Code: void CreatePage() { Section section = _document.AddSection(); section.PageSetup.PageWidth = "21.59cm"; section.PageSetup.PageHeight = "27.94cm"; section.PageSetup.TopMargin = "3.81cm"; section.PageSetup.LeftMargin = "2.54cm"; section.PageSetup.RightMargin = "2.54cm"; section.PageSetup.BottomMargin = "2.54cm"; Image image = section.Headers.Primary.AddImage("../../line.png"); image.Height = "0.2cm"; image.Width = "16.51cm"; image.RelativeVertical = RelativeVertical.Line; image.RelativeHorizontal = RelativeHorizontal.Page; image.Left = ShapePosition.Center; image.Top = ShapePosition.Top; // Put a logo in the header image = section.Headers.Primary.AddImage("../../Logo.png"); image.Height = "1.524cm"; image.Width = "2.032cm"; image.WrapFormat.DistanceTop = "0.25cm"; TextFrame frame = section.Headers.Primary.AddTextFrame(); Paragraph framePara = frame.AddParagraph("Name"); framePara.Format.Alignment = ParagraphAlignment.Center; framePara = frame.AddParagraph("PROJECT EXPERIENCE"); framePara.Format.Alignment = ParagraphAlignment.Center; frame.Width = "21.59cm"; frame.Left = "0cm"; frame.Top = "2.05cm"; frame.RelativeHorizontal = RelativeHorizontal.Page; frame.RelativeVertical = RelativeVertical.Page; image = section.Headers.Primary.AddImage("../../line.png"); image.Height = "0.2cm"; image.Width = "16.5cm"; image.RelativeHorizontal = RelativeHorizontal.Page; image.Left = ShapePosition.Center; image.Top = ShapePosition.Top; image.WrapFormat.DistanceTop = "0.25cm"; // Create footer Paragraph paragraph; frame = section.Footers.Primary.AddTextFrame(); image = frame.AddImage("../../line.png"); image.Height = "0.2cm"; image.Width = "16.5cm"; image.Left = ShapePosition.Center; image.Top = ShapePosition.Top; image.WrapFormat.DistanceBottom = "1cm"; paragraph = frame.AddParagraph() ; paragraph.AddPageField(); paragraph.Format.Font.Size = 11; paragraph.Format.Alignment = ParagraphAlignment.Center; frame.RelativeHorizontal = RelativeHorizontal.Page; frame.RelativeVertical = RelativeVertical.Line; frame.Left = ShapePosition.Center; //print projects paragraph = section.AddParagraph("Major Project Include:", "BodyStart"); paragraph = section.AddParagraph("site","Site"); for (int x = 0; x < 20; x++) { paragraph = section.AddParagraph("Project Name", "ProjectTitle"); paragraph = section.AddParagraph("asdfg ioupwerj ;lkjasdfiopue kjweue a;kjep asdkjv nmdfgp eopit adkljb lawerpoi aasdkljer apoeiradfj aerpoia asdfl;kjwer opiasdf ", "Description"); } } } The rest of the code has been borrowed from the examples. I have been dealing with the footer for quite a while now, and I am starting to get frustrated. I have tried setting the exact location of the textframe, but nothing seems to get it down that extra 1 cm. Any pointers would be greatly appreciated. |
|
| Author: | a.harper [ Tue Jul 16, 2013 2:39 pm ] |
| Post subject: | Re: Footer Formatting Issues |
I found a solution. It is hacky but it works. I added a margin of 1cm to the top of my textframe. It drove it down the 1cm I needed. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|