protected override void PopulateRichText() { // Get references to the heading styles NDocumentBlock documentBlock = m_RichText.Content; NRichTextStyle heading1Style = documentBlock.Styles.FindStyleByTypeAndId(ENRichTextStyleType.Paragraph, "Heading1"); NRichTextStyle heading2Style = documentBlock.Styles.FindStyleByTypeAndId(ENRichTextStyleType.Paragraph, "Heading2"); NSection section = new NSection(); m_RichText.Content.Sections.Add(section); // Add a table of contents block NTableOfContentsBlock tableOfContents = new NTableOfContentsBlock(); section.Blocks.Add(tableOfContents); // Create chapter 1 NParagraph paragraph = new NParagraph("Chapter 1"); section.Blocks.Add(paragraph); heading1Style.Apply(paragraph); paragraph = new NParagraph("Topic 1.1"); section.Blocks.Add(paragraph); heading2Style.Apply(paragraph); AddParagraphs(section, "This is a sample paragraph from the first topic of chapter one.", 20); paragraph = new NParagraph("Topic 1.2"); section.Blocks.Add(paragraph); heading2Style.Apply(paragraph); AddParagraphs(section, "This is a sample paragraph from the second topic of chapter one.", 20); // Create chapter 2 paragraph = new NParagraph("Chapter 2"); section.Blocks.Add(paragraph); heading1Style.Apply(paragraph); paragraph = new NParagraph("Topic 2.1"); section.Blocks.Add(paragraph); heading2Style.Apply(paragraph); AddParagraphs(section, "This is a sample paragraph from the first topic of chapter two.", 20); paragraph = new NParagraph("Topic 2.2"); section.Blocks.Add(paragraph); heading2Style.Apply(paragraph); AddParagraphs(section, "This is a sample paragraph from the second topic of chapter two.", 20); // Update the table of contents m_RichText.Document.Evaluate(); tableOfContents.Update(); }
protected override void PopulateRichText() { NDocumentBlock documentBlock = m_RichText.Content; NSection section = new NSection(); documentBlock.Sections.Add(section); // Create the first table section.Blocks.Add(new NParagraph("Table with predefined table style:")); NTable table1 = CreateTable(); section.Blocks.Add(table1); // Apply a predefined table style NRichTextStyle predefinedStyle = documentBlock.Styles.FindStyleByTypeAndId(ENRichTextStyleType.Table, "GridTable2Blue"); predefinedStyle.Apply(table1); // Create the second table NParagraph paragraph = new NParagraph("Table with custom table style:"); paragraph.MarginTop = 30; section.Blocks.Add(paragraph); NTable table2 = CreateTable(); section.Blocks.Add(table2); // Create a custom table style and apply it NTableStyle customStyle = new NTableStyle("CustomTableStyle"); customStyle.WholeTable = new NTablePartStyle(); customStyle.WholeTable.BorderRule = new NBorderRule(ENPredefinedBorderStyle.Solid, NColor.DarkRed, new NMargins(1)); customStyle.WholeTable.BorderRule.InsideHSides = new NBorderSideRule(ENPredefinedBorderStyle.Solid, NColor.DarkRed, 1); customStyle.WholeTable.BorderRule.InsideVSides = new NBorderSideRule(ENPredefinedBorderStyle.Solid, NColor.DarkRed, 1); customStyle.FirstRow = new NTablePartStyle(); customStyle.FirstRow.BackgroundFill = new NColorFill(NColor.DarkRed); customStyle.FirstRow.InlineRule = new NInlineRule(NColor.White); customStyle.FirstRow.InlineRule.FontStyle = ENFontStyle.Bold; customStyle.Apply(table2); }
protected override void PopulateRichText() { base.PopulateRichText(); NDocumentBlock documentBlock = m_RichText.Content; NRichTextStyle heading1Style = documentBlock.Styles.FindStyleByTypeAndId( ENRichTextStyleType.Paragraph, "Heading1"); // Add chapter 1 NSection section = new NSection(); documentBlock.Sections.Add(section); NParagraph paragraph = new NParagraph("Chapter 1: EPUB Import"); section.Blocks.Add(paragraph); heading1Style.Apply(paragraph); paragraph = new NParagraph("NOV Rich Text Editor lets you import Electronic Publications. " + "Thus you can use it to read e-books on your PC or MAC."); section.Blocks.Add(paragraph); paragraph = new NParagraph("You can also use it to import and edit existing Electronic Publications and books."); section.Blocks.Add(paragraph); // Add chapter 2 section = new NSection(); section.BreakType = ENSectionBreakType.NextPage; documentBlock.Sections.Add(section); paragraph = new NParagraph("Chapter 2: EPUB Export"); section.Blocks.Add(paragraph); heading1Style.Apply(paragraph); paragraph = new NParagraph("NOV Rich Text Editor lets you export a rich text document to an Electronic Publication. " + "Thus you can use it to create e-books on your PC or MAC."); section.Blocks.Add(paragraph); paragraph = new NParagraph("You can also use it to import and edit existing Electronic Publications and books."); section.Blocks.Add(paragraph); }
protected override void PopulateRichText() { NDocumentBlock documentBlock = m_RichText.Content; NSection section = new NSection(); documentBlock.Sections.Add(section); // Create the first paragraph NParagraph paragraph1 = new NParagraph("This paragraph is styled with a predefined paragraph style."); section.Blocks.Add(paragraph1); // Apply a predefined paragraph style NRichTextStyle predefinedStyle = documentBlock.Styles.FindStyleByTypeAndId(ENRichTextStyleType.Paragraph, "Heading2"); predefinedStyle.Apply(paragraph1); // Create the second paragraph NParagraph paragraph2 = new NParagraph("This paragraph is styled with a custom paragraph style."); section.Blocks.Add(paragraph2); // Create a custom paragraph style and apply it NParagraphStyle customStyle = new NParagraphStyle("CustomStyle"); customStyle.ParagraphRule = new NParagraphRule(); customStyle.ParagraphRule.BorderRule = new NBorderRule(ENPredefinedBorderStyle.Dash, NColor.Red, new NMargins(1)); customStyle.ParagraphRule.HorizontalAlignment = ENAlign.Center; customStyle.ParagraphRule.Padding = new NMargins(20); customStyle.InlineRule = new NInlineRule(); customStyle.InlineRule.Fill = new NColorFill(NColor.Blue); customStyle.Apply(paragraph2); paragraph2.MarginTop = 30; }