Hi,
I'm new to Migradoc and PDFSharp and I want to have a header containing multiple lines and styles. I coded this way:
Code:
Document documento = new Document();
documento.Info.Title = "Caratula del Contrato";
Style style = documento.Styles["Normal"];
style.Font.Name = "Verdana";
Section section = documento.AddSection();
section.PageSetup.TopMargin = Unit.FromCentimeter(3);
//Header
Paragraph header = section.Headers.Primary.AddParagraph();
header.AddText(this.recaI);
header.AddLineBreak();
header.AddText("CreaBienestar");
header.AddLineBreak();
style = documento.Styles.AddStyle("Header1", "Normal");
style.Font.Name = "Elegance";
style.Font.Size = 9;
header.AddFormattedText("CREA BIENESTAR, S.A. de C.V., SOFOM, E.N.R.", "Header1");
header.AddLineBreak();
header.AddText("Crédito y Bienestar para tu familia");
header.Format.Alignment = ParagraphAlignment.Right;
My header must have 4 lines with different style each line, I'm adding linebreaks in my code to make this happen. However my problem is with the styles.
In My code I try to add a style to line 3 but my document is not rendered. If AddText method it is used in line 3 my document is rendered fine, but no styles are added. Do you know what I'm doing wrong?