Reputation: 369
Very new to this... I can't seem to get the Paragraph on the lower/left to top align with the rotated TextFrame on the right. Is there a way to do this in MigraDoc? (note: if it matters, the red text flows onto multiple pages)
Also, I would like the TextFrame to show up on each generated page, but it doesn't.
public static Document CreateWorkOrderPDF2(Document document, string filename, string WorkOrderHeader, string myMessage)
{
Section section = document.AddSection();
section.PageSetup.PageFormat = PageFormat.Letter;
section.PageSetup.StartingNumber = 1;
section.PageSetup.LeftMargin = 40;
//Sets the height of the top margin
section.PageSetup.TopMargin = 100;
section.PageSetup.RightMargin = 40;
section.PageSetup.BottomMargin = 40;
//HeaderFooter
HeaderFooter header = section.Headers.Primary;
header.Format.Font.Size = 16;
header.Format.Font.Color = Colors.DarkBlue;
MigraDoc.DocumentObjectModel.Shapes.Image headerImage = header.AddImage("../../Fonts/castorgate.regular.png");
headerImage.Width = "2cm";
Paragraph headerParagraph = header.AddParagraph(WorkOrderHeader);
headerParagraph.Format.Font.Name = "Consolas";
//Vertical Text
TextFrame myTextFrame = section.AddTextFrame();
myTextFrame.Orientation = TextOrientation.Downward;
//moves text to the right
myTextFrame.Left = 550;
myTextFrame.Width = 10;
myTextFrame.Top = 0;
myTextFrame.Height = 150;
Paragraph myP = myTextFrame.AddParagraph();
myP.Format.Alignment = ParagraphAlignment.Left;
myP.Format.Font.Name = "Consolas";
myP.Format.Font.Size = 8;
myP.AddText(WorkOrderHeader);
myP.Format.Borders.Width = .5;
//BODY PARAGRAPH
Paragraph bodyParagraph = section.AddParagraph(myMessage);
bodyParagraph.Format.Font.Size = 10;
bodyParagraph.Format.Font.Color = Colors.DarkRed;
bodyParagraph.Format.Borders.Width = .5;
bodyParagraph.Format.RightIndent = 50;
Paragraph renderDate = section.AddParagraph();
renderDate = section.AddParagraph("Work Order Generated: ");
renderDate.AddDateField();
return document;
}
Upvotes: 1
Views: 721
Reputation: 21689
I think all you have to add is myTextFrame.WrapFormat.Style = WrapStyle.Through;
Upvotes: 1