/// <summary> /// Adds rich formatted text to the specified text block content /// </summary> /// <param name="content"></param> private void AddFormattedTextToContent(NTextBlockContent content) { content.Blocks.Add(GetTitleParagraph("Bullet lists allow you to apply automatic numbering on paragraphs or groups of blocks.", 1)); // setting bullet list template type { content.Blocks.Add(GetTitleParagraph("Following are bullet lists with different formatting", 2)); ENBulletListTemplateType[] values = NEnum.GetValues <ENBulletListTemplateType>(); string[] names = NEnum.GetNames <ENBulletListTemplateType>(); string itemText = "Bullet List Item"; for (int i = 0; i < values.Length - 1; i++) { NGroupBlock group = new NGroupBlock(); content.Blocks.Add(group); group.MarginTop = 10; group.MarginBottom = 10; NBulletList bulletList = new NBulletList(values[i]); content.BulletLists.Add(bulletList); for (int j = 0; j < 3; j++) { NParagraph paragraph = new NParagraph(itemText + j.ToString()); NBulletInline bullet = new NBulletInline(); bullet.List = bulletList; paragraph.Bullet = bullet; group.Blocks.Add(paragraph); } } } // nested bullet lists { content.Blocks.Add(GetTitleParagraph("Following is an example of bullets with different bullet level", 2)); NBulletList bulletList = new NBulletList(ENBulletListTemplateType.Decimal); content.BulletLists.Add(bulletList); NGroupBlock group = new NGroupBlock(); content.Blocks.Add(group); for (int i = 0; i < 3; i++) { NParagraph par = new NParagraph("Bullet List Item" + i.ToString(), bulletList, 0); group.Blocks.Add(par); for (int j = 0; j < 2; j++) { NParagraph nestedPar = new NParagraph("Nested Bullet List Item" + i.ToString(), bulletList, 1); nestedPar.MarginLeft = 10; group.Blocks.Add(nestedPar); } } } }
public override NDocumentBlock CreateDocument() { NDocumentBlock document = base.CreateDocument(); NSection section = document.Sections[0]; section.Blocks.Add(new NParagraph("This is the first paragraph.")); section.Blocks.Add(new NParagraph("This is the second paragraph.\nThis is part of the second paragraph, too.")); NGroupBlock div = new NGroupBlock(); section.Blocks.Add(div); div.Fill = new NColorFill(NColor.Red); NParagraph p = new NParagraph("This is a paragraph in a div. It should have red underlined text."); div.Blocks.Add(p); p.FontStyle = ENFontStyle.Underline; p = new NParagraph("This is another paragraph in the div. It contains a "); div.Blocks.Add(p); NTextInline inline = new NTextInline("bold italic blue inline"); p.Inlines.Add(inline); inline.Fill = new NColorFill(NColor.Blue); inline.FontStyle = ENFontStyle.Bold | ENFontStyle.Italic; p.Inlines.Add(new NTextInline(".")); return(document); }
/// <summary> /// /// </summary> /// <param name="title"></param> /// <param name="description"></param> /// <param name="level"></param> /// <returns></returns> internal static NGroupBlock GetNoteBlock(string text, int level) { NColor color = NColor.Red; NParagraph paragraph = GetTitleParagraphNoBorder("Note", level); NGroupBlock groupBlock = new NGroupBlock(); groupBlock.ClearMode = ENClearMode.All; groupBlock.Blocks.Add(paragraph); groupBlock.Blocks.Add(GetDescriptionParagraph(text)); groupBlock.Border = CreateLeftTagBorder(color); groupBlock.BorderThickness = defaultBorderThickness; return(groupBlock); }
/// <summary> /// /// </summary> protected override void PopulateRichText() { m_Books = new NBookInfoList(); m_CurrentBookIndex = 0; NSection section = new NSection(); m_RichText.Content.Sections.Add(section); m_RichText.Document.StyleSheets.Add(CreateShoppingCartStyleSheet()); { NTable navigationTable = new NTable(1, 2); NTableCell cell0 = navigationTable.Rows[0].Cells[0]; NButton showPrevBookButton = new NButton("Show Prev Book"); showPrevBookButton.Click += new Function <NEventArgs>(OnShowPrevBookButtonClick); cell0.Blocks.Clear(); cell0.Blocks.Add(CreateWidgetParagraph(showPrevBookButton)); NTableCell cell1 = navigationTable.Rows[0].Cells[1]; NButton showNextBookButton = new NButton("Show Next Book"); showNextBookButton.Click += new Function <NEventArgs>(OnShowNextBookButtonClick); cell1.Blocks.Clear(); cell1.Blocks.Add(CreateWidgetParagraph(showNextBookButton)); section.Blocks.Add(navigationTable); } m_BookInfoPlaceHolder = new NGroupBlock(); section.Blocks.Add(m_BookInfoPlaceHolder); { m_BookInfoPlaceHolder.Blocks.Add(CreateBookContent(m_Books[0])); } { m_ShoppingCartPlaceHolder = new NGroupBlock(); AddEmptyShoppingCartText(); section.Blocks.Add(m_ShoppingCartPlaceHolder); } }