| ||
SharpPlot Tutorials General Tutorials Chart Samples Style Examples Document Layout Tutorials Table Tutorials Visual Glossaries SharpPlot Reference SharpPlot Class SharpPlot Properties SharpPlot Methods SharpPlot Structures SharpPlot Enumerations PageMap Class SharpLeaf Reference SharpLeaf Class SharpLeaf Properties SharpLeaf Methods Table Class Table Properties Table Methods SharpLeaf Structures FontType Structure ParagraphStyle Structure BoxStyle Structure SharpLeaf Enumerations DocumentLayout Classes DocumentLayout Class PageLayout Class PageElement Abstract Class Frame : PageElement Class TextBlock : PageElement Class ImageBlock : PageElement Class Box : PageElement Class Rule : PageElement Class Common Reference Document Class VectorMath Class DbUtil Class Download Release Notes Licensing |
SharpLeaf Tutorials > Text Flow Tutorials > Flowing Paragraphs Flowing ParagraphsThe most straightforward way to flow text into a SharpLeaf document is to attach ParagraphStyles to text paragraphs. page = new PageLayout(PaperSize.Landscape(PaperSize.A5)); page.Add(new Frame("Main",36,36,-36,-36)); // Half-inch margin all around layout = new DocumentLayout(page); body = new ParagraphStyle(); body.Font = new FontType("Times",12); body.IndentFirst = 36; body.SpaceAfter = -1; // Equivalent of one empty line of text bullet = body.Clone(); // Take deep copy as of now bullet.SpaceBetween = false; // No space between bullet list items bullet.SetBullet("{1}."); // Use numbered bullets bullet.BulletIndent = body.IndentFirst; // Use same indent for bullets bullet.IndentFirst = 0; // Unset the IndentFirst inherited from body title = new ParagraphStyle(); title.Font = new FontType("Garamond",15,FontStyle.Bold,Color.Navy); title.IndentLeft = body.IndentFirst; // Use same indent for titles title.SpaceBefore = -1; // Leave room before a title - unless at top of frame title.SpaceAfter = -1; // Leave room after a title title.BookmarkLevel = 1; // Automatically bookmark titles at top level lf = new SharpLeaf(layout); para = "Here's a dummy paragraph of text. As the qualifier suggests its content is "+ "not particularly interesting, but it still reaches its goal of being long "+ "enough to take up more than one line."; paras = new string[]{para,para}; list = new string[]{"First item on list","Another item here","And a last one there"}; // Flow paragraphs with their styles lf.AddParagraphs("First title",title); lf.AddParagraphs(paras,body); lf.AddParagraphs(list,bullet); lf.AddParagraphs(para,body); lf.AddParagraphs("Second title",title); lf.AddParagraphs(paras,body); See also ...Text Flow Tutorials | Paragraph Glossary | SharpLeaf.Style Property | SharpLeaf.AddParagraphs Method | ParagraphStyle.Members |