PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Setting two textFrames at the same Height
https://forum.pdfsharp.net/viewtopic.php?f=2&t=4135
Page 1 of 1

Author:  newbieCoder34 [ Mon May 25, 2020 4:14 pm ]
Post subject:  Setting two textFrames at the same Height

I want one textframe to be on the left and one to be on the right at even lengths.

My code:

Code:
public void DefineInvoice(Document document,List<TicketView1> SampleTickets)
        {
            Section section = document.AddSection();

            // create the text frame for address
            TextFrame addressFrame = section.AddTextFrame();
            addressFrame.Height = "3.0cm";
            addressFrame.Width = "7.0cm";
            addressFrame.Left = ShapePosition.Left;
            //addressFrame.RelativeHorizontal = RelativeHorizontal.Margin;
            //addressFrame.MarginTop = "3.0cm";
            //addressFrame.RelativeVertical = RelativeVertical.Page;

            TextFrame invoiceFrame = section.AddTextFrame();
            invoiceFrame.Height = "3.0cm";
            invoiceFrame.Width = "7.0cm";
            invoiceFrame.Left = ShapePosition.Right;



            //fill in address for text frame
            Paragraph paragraph = addressFrame.AddParagraph();
            paragraph.AddText("Nieto LLC");
            paragraph.AddLineBreak();
            paragraph.AddText("6110 Google Drive");
            paragraph.AddLineBreak();
            paragraph.AddText("Houston, TX 77309");
            paragraph.AddLineBreak();
            paragraph.AddText("P: 281-890-5899");

            paragraph = invoiceFrame.AddParagraph();
            paragraph.AddText("INVOICE NO");


Attachments:
File comment: invoice
Screenshot (4).png
Screenshot (4).png [ 208.82 KiB | Viewed 2390 times ]

Author:  newbieCoder34 [ Mon May 25, 2020 6:16 pm ]
Post subject:  Re: Setting two textFrames at the same Height

I found that using this code works:

Code:
TextFrame invoiceFrame = section.AddTextFrame();
            invoiceFrame.Height = "3.0cm";
            invoiceFrame.Width = "5.0cm";
            invoiceFrame.Left = ShapePosition.Right;
            invoiceFrame.MarginTop = "-3.0cm";


Is there a better way?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/