protected override NWidget CreateExampleContent() { // Create the rich text m_RichText = new NRichTextView(); m_RichText.AcceptsTab = true; m_RichText.Content.Sections.Clear(); NSection section = new NSection(); section.Blocks.Add(new NParagraph("Type some content here")); m_RichText.Content.Sections.Add(section); m_RichText.Content.Layout = ENTextLayout.Web; m_RichText.VScrollMode = ENScrollMode.Never; m_RichText.HScrollMode = ENScrollMode.Never; m_RichText.HRuler.Visibility = ENVisibility.Hidden; m_RichText.VRuler.Visibility = ENVisibility.Hidden; m_RichText.PreferredWidth = double.NaN; m_RichText.PreferredHeight = double.NaN; m_RichText.Border = NBorder.CreateFilledBorder(NColor.Black); m_RichText.BorderThickness = new NMargins(1); m_RichText.HorizontalPlacement = Layout.ENHorizontalPlacement.Fit; m_RichText.VerticalPlacement = Layout.ENVerticalPlacement.Top; return(m_RichText); }
protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); // paragraphs with different horizontal alignment section.Blocks.Add(GetDescriptionBlock("Paragraphs can contain tab stops", "This example shows how to programmatically add tab stops to paragraphs", 2)); NParagraph paragraph = new NParagraph(); paragraph.Inlines.Add(new NTabInline()); paragraph.Inlines.Add(new NTextInline("Left.")); paragraph.Inlines.Add(new NTabInline()); paragraph.Inlines.Add(new NTextInline("Right.")); paragraph.Inlines.Add(new NTabInline()); paragraph.Inlines.Add(new NTextInline("Center.")); paragraph.Inlines.Add(new NTabInline()); paragraph.Inlines.Add(new NTextInline("Decimal 345.33")); NTabStopCollection tabStops = new NTabStopCollection(); tabStops.Add(new Nevron.Nov.Text.NTabStop(100, ENTabStopAlignment.Left, ENTabStopLeaderStyle.Dots)); tabStops.Add(new Nevron.Nov.Text.NTabStop(200, ENTabStopAlignment.Right, ENTabStopLeaderStyle.EqualSigns)); tabStops.Add(new Nevron.Nov.Text.NTabStop(300, ENTabStopAlignment.Center, ENTabStopLeaderStyle.Hyphens)); tabStops.Add(new Nevron.Nov.Text.NTabStop(500, ENTabStopAlignment.Decimal, ENTabStopLeaderStyle.Underline)); paragraph.TabStops = tabStops; paragraph.WidowOrphanControl = false; section.Blocks.Add(paragraph); }
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); }
protected override void PopulateRichText() { NDocumentBlock documentBlock = m_RichText.Content; NSection section = new NSection(); documentBlock.Sections.Add(section); NParagraph paragraph = new NParagraph(); section.Blocks.Add(paragraph); // Create the first inline NTextInline inline1 = new NTextInline("This is the first inline. "); paragraph.Inlines.Add(inline1); // Create and apply an inline style NInlineStyle style1 = new NInlineStyle("MyRedStyle"); style1.Rule = new NInlineRule(NColor.Red); style1.Rule.FontStyle = ENFontStyle.Bold; style1.Apply(inline1); // Create the second inline NTextInline inline2 = new NTextInline("This is the second inline."); paragraph.Inlines.Add(inline2); // Create and apply an inline style NInlineStyle style2 = new NInlineStyle("MyBlueStyle"); style2.Rule = new NInlineRule(NColor.Blue); style2.Rule.FontStyle = ENFontStyle.Italic; style2.Apply(inline2); }
public override NDocumentBlock CreateDocument() { NDocumentBlock document = base.CreateDocument(); // Create a simple 2x2 table NSection section = document.Sections[0]; NTable table = new NTable(2, 2); section.Blocks.Add(table); for (int row = 0, i = 1; row < table.Rows.Count; row++) { for (int col = 0; col < table.Columns.Count; col++, i++) { InitCell(table.Rows[row].Cells[col], "Cell " + i.ToString()); } } // Create a 3x3 table with rowspans and colspans table = new NTable(4, 3); section.Blocks.Add(table); InitCell(table.Rows[0].Cells[0], 2, 1, "Cell 1 (2 rows)"); InitCell(table.Rows[0].Cells[1], "Cell 2"); InitCell(table.Rows[0].Cells[2], "Cell 3"); InitCell(table.Rows[1].Cells[1], 1, 2, "Cell 4 (2 cols)"); InitCell(table.Rows[2].Cells[0], "Cell 5"); InitCell(table.Rows[2].Cells[1], 2, 2, "Cell 6 (2 rows x 2 cols)"); InitCell(table.Rows[3].Cells[0], "Cell 7"); return(document); }
public override NDocumentBlock CreateDocument() { NDocumentBlock document = base.CreateDocument(); NSection section = document.Sections[0]; NParagraph p = new NParagraph("Black solid border"); section.Blocks.Add(p); p.Border = NBorder.CreateFilledBorder(NColor.Black); p.BorderThickness = new NMargins(1); p = new NParagraph("Black dashed border"); section.Blocks.Add(p); p.Border = new NBorder(); p.Border.MiddleStroke = new NStroke(5, NColor.Black, ENDashStyle.Dash); p.BorderThickness = new NMargins(5); p = new NParagraph("Green/DarkGreen two-color border"); section.Blocks.Add(p); p.Border = NBorder.CreateTwoColorBorder(NColor.Green, NColor.DarkGreen); p.BorderThickness = new NMargins(10); p = new NParagraph("A border with left, right and bottom sides and wide but not set top side"); section.Blocks.Add(p); p.Border = new NBorder(); p.Border.LeftSide = new NThreeColorsBorderSide(NColor.Black, NColor.Gray, NColor.LightGray); p.Border.RightSide = new NBorderSide(); p.Border.RightSide.OuterStroke = new NStroke(10, NColor.Blue, ENDashStyle.Dot); p.Border.BottomSide = new NBorderSide(NColor.Red); p.BorderThickness = new NMargins(9, 50, 5, 5); return(document); }
protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(GetDescriptionBlock("Block Size", "Every block in the document can have a specified Preferred, Minimum and Maximum size.", 1)); section.Blocks.Add(GetDescriptionBlock("Preferred Width and Height", "The following paragraph has specified Preferred Width and Height.", 2)); NParagraph paragraph1 = new NParagraph("Paragraph with Preferred Width 50% and Preferred Height of 200dips."); paragraph1.BackgroundFill = new NColorFill(NColor.LightGray); paragraph1.PreferredWidth = new NMultiLength(ENMultiLengthUnit.Percentage, 50); paragraph1.PreferredHeight = new NMultiLength(ENMultiLengthUnit.Dip, 200); section.Blocks.Add(paragraph1); section.Blocks.Add(GetDescriptionBlock("Minimum and Maximum Width and Height", "The following paragraph has specified Minimum and Maximum Width.", 2)); NParagraph paragraph2 = new NParagraph("Paragraph with Preferred Width 50% and Preferred Height of 200dips and Minimum Width of 200 dips and Maximum Width 300 dips."); paragraph2.BackgroundFill = new NColorFill(NColor.LightGray); paragraph2.PreferredWidth = new NMultiLength(ENMultiLengthUnit.Percentage, 50); paragraph2.PreferredHeight = new NMultiLength(ENMultiLengthUnit.Dip, 200); paragraph2.MinWidth = new NMultiLength(ENMultiLengthUnit.Dip, 200); paragraph2.MaxWidth = new NMultiLength(ENMultiLengthUnit.Dip, 300); section.Blocks.Add(paragraph2); }
/// <summary> /// /// </summary> protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(new NParagraph("Type some text here...")); }
protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(GetDescriptionBlock("Ribbon Customization", "This example demonstrates how to customize the NOV rich text ribbon.", 1)); }
protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(GetDescriptionBlock("Table Master Cells Example", "This example shows how to programmatically create and add master cells.", 1)); // first create the table NTable table = new NTable(5, 5); table.AllowSpacingBetweenCells = false; for (int row = 0; row < table.Rows.Count; row++) { for (int col = 0; col < table.Columns.Count; col++) { NParagraph paragraph = new NParagraph("Normal Cell"); NTableCell tableCell = table.Rows[row].Cells[col]; tableCell.BorderThickness = new Nov.Graphics.NMargins(1); tableCell.Border = NBorder.CreateFilledBorder(NColor.Black); // by default cells contain a single paragraph tableCell.Blocks.Clear(); tableCell.Blocks.Add(paragraph); } } // set cell [0, 2] to be column master NTableCell colMasterCell = table.Rows[0].Cells[2]; colMasterCell.ColSpan = 2; colMasterCell.BackgroundFill = new NColorFill(ENNamedColor.LightSkyBlue); colMasterCell.Blocks.Clear(); colMasterCell.Blocks.Add(new NParagraph("Column Master Cell")); // set cell [1, 0] to be row master NTableCell rowMasterCell = table.Rows[1].Cells[0]; rowMasterCell.RowSpan = 2; rowMasterCell.BackgroundFill = new NColorFill(ENNamedColor.LightSteelBlue); rowMasterCell.Blocks.Clear(); rowMasterCell.Blocks.Add(new NParagraph("Row Master Cell")); // set cell [2, 2] to be column and row master NTableCell rowColMasterCell = table.Rows[2].Cells[2]; rowColMasterCell.ColSpan = 2; rowColMasterCell.RowSpan = 2; rowColMasterCell.BackgroundFill = new NColorFill(ENNamedColor.MediumTurquoise); rowColMasterCell.Blocks.Clear(); rowColMasterCell.Blocks.Add(new NParagraph("Row\\Col Master Cell")); section.Blocks.Add(table); }
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(); }
private void AddParagraphs(NSection section, string text, int count) { // Duplicate the given text 5 times text = String.Join(" ", new string[] { text, text, text, text, text }); // Create the given number of paragraphs with the text for (int i = 0; i < count; i++) { section.Blocks.Add(new NParagraph(text)); } }
protected override void PopulateRichText() { NDocumentBlock documentBlock = m_RichText.Content; documentBlock.Layout = ENTextLayout.Print; NSection section = new NSection(); documentBlock.Sections.Add(section); section.Blocks.Add(GetDescriptionBlock("Barcode Widget Inlines", "Nevron Open Vision lets you easily insert barcodes in text documents as widget inlines.", 1)); // Create a table NTable table = new NTable(2, 2); section.Blocks.Add(table); // Create a linear barcode NLinearBarcode linearBarcode = new NLinearBarcode(ENLinearBarcodeSymbology.EAN13, "0123456789012"); NWidgetInline widgetInline = new NWidgetInline(linearBarcode); // Create a paragraph to host the linear barcode widget inline NTableCell cell = table.Rows[0].Cells[0]; cell.HorizontalAlignment = ENAlign.Center; NParagraph paragraph = (NParagraph)cell.Blocks[0]; paragraph.Inlines.Add(widgetInline); // Create a paragraph to the right with some text cell = table.Rows[0].Cells[1]; paragraph = (NParagraph)cell.Blocks[0]; paragraph.Inlines.Add(new NTextInline("The linear barcode to the left uses the EAN13 symbology.")); // Create a QR code widget inline NMatrixBarcode qrCode = new NMatrixBarcode(ENMatrixBarcodeSymbology.QrCode, "https://www.nevron.com"); widgetInline = new NWidgetInline(qrCode); // Create a paragraph to host the QR code widget inline cell = table.Rows[1].Cells[0]; cell.HorizontalAlignment = ENAlign.Center; paragraph = (NParagraph)cell.Blocks[0]; paragraph.Inlines.Add(widgetInline); // Create a paragraph to the right with some text cell = table.Rows[1].Cells[1]; paragraph = (NParagraph)cell.Blocks[0]; paragraph.Inlines.Add(new NTextInline("The QR code to the left contains a link to ")); paragraph.Inlines.Add(new NHyperlinkInline("https://www.nevron.com", "https://www.nevron.com")); paragraph.Inlines.Add(new NTextInline(".")); }
protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(GetDescriptionBlock("Table Cell Orientation Example", "This example shows how to programmatically modify the orientation of cells.", 1)); // first create the table NTable table = new NTable(5, 5); table.AllowSpacingBetweenCells = false; for (int row = 0; row < table.Rows.Count; row++) { for (int col = 0; col < table.Columns.Count; col++) { NParagraph paragraph = new NParagraph("Normal Cell"); NTableCell tableCell = table.Rows[row].Cells[col]; tableCell.BorderThickness = new Nov.Graphics.NMargins(1); tableCell.Border = NBorder.CreateFilledBorder(NColor.Black); // by default cells contain a single paragraph tableCell.Blocks.Clear(); tableCell.Blocks.Add(paragraph); } } // set cell [1, 0] to be row master NTableCell leftToRightCell = table.Rows[1].Cells[0]; leftToRightCell.RowSpan = int.MaxValue; leftToRightCell.BackgroundFill = new NColorFill(ENNamedColor.LightSteelBlue); leftToRightCell.Blocks.Clear(); leftToRightCell.Blocks.Add(new NParagraph("Cell With Left to Right Orientation")); leftToRightCell.TextDirection = ENTableCellTextDirection.LeftToRight; leftToRightCell.HorizontalAlignment = ENAlign.Center; leftToRightCell.VerticalAlignment = ENVAlign.Center; // set cell [1, 0] to be row master NTableCell rightToLeftCell = table.Rows[1].Cells[table.Columns.Count - 1]; rightToLeftCell.RowSpan = int.MaxValue; rightToLeftCell.BackgroundFill = new NColorFill(ENNamedColor.LightGreen); rightToLeftCell.Blocks.Clear(); rightToLeftCell.Blocks.Add(new NParagraph("Cell With Right to Left Orientation")); rightToLeftCell.TextDirection = ENTableCellTextDirection.RightToLeft; rightToLeftCell.HorizontalAlignment = ENAlign.Center; rightToLeftCell.VerticalAlignment = ENVAlign.Center; section.Blocks.Add(table); }
/// <summary> /// /// </summary> protected override void PopulateRichText() { m_RichText.Content.Layout = ENTextLayout.Print; m_RichText.Content.ZoomFactor = 0.5; for (int sectionIndex = 0; sectionIndex < 4; sectionIndex++) { NSection section = new NSection(); section.Margins = NMargins.Zero; section.Padding = NMargins.Zero; string sectionText = string.Empty; switch (sectionIndex) { case 0: sectionText = "Paper size A4."; section.PageSize = new NPageSize(ENPaperKind.A4); section.BreakType = ENSectionBreakType.NextPage; section.Blocks.Add(GetDescriptionBlock("Section Pages", "This example shows how to set different page properties, like page size, page orientation and page border", 1)); break; case 1: sectionText = "Paper size A5."; section.PageSize = new NPageSize(ENPaperKind.A5); section.BreakType = ENSectionBreakType.NextPage; break; case 2: sectionText = "Paper size A4, paper orientation portrait."; section.PageOrientation = ENPageOrientation.Landscape; section.PageSize = new NPageSize(ENPaperKind.A4); section.BreakType = ENSectionBreakType.NextPage; break; case 3: sectionText = "Paper size A4, page border solid 10dip."; section.PageBorder = NBorder.CreateFilledBorder(NColor.Black); section.PageBorderThickness = new NMargins(10); section.PageSize = new NPageSize(ENPaperKind.A4); section.BreakType = ENSectionBreakType.NextPage; break; } m_RichText.Content.Sections.Add(section); // add some content NParagraph paragraph = new NParagraph(sectionText); section.Blocks.Add(paragraph); } }
/// <summary> /// /// </summary> /// <param name="section"></param> /// <param name="bulletListType"></param> /// <param name="items"></param> /// <param name="itemText"></param> private void CreateSampleBulletList(NSection section, ENBulletListTemplateType bulletListType, int items, string itemText) { NBulletList bulletList = new NBulletList(bulletListType); m_RichText.Content.BulletLists.Add(bulletList); for (int i = 0; i < items; i++) { NParagraph par = new NParagraph(itemText + i.ToString()); par.SetBulletList(bulletList, 0); section.Blocks.Add(par); } }
protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(GetDescriptionBlock("Find and Replace Text", "The example demonstrates how to work find and replace text.", 1)); for (int i = 0; i < 10; i++) { section.Blocks.Add(new NParagraph("Now it so happened that on one occasion the princess's golden ball did not fall into the little hand which she was holding up for it, but on to the ground beyond, and rolled straight into the water. She followed it with her eyes, but it vanished, and the well was deep, so deep that the bottom could not be seen. At this she began to cry, and cried louder and louder, and could not be comforted. And as she thus lamented someone said to her, \"What ails you? You weep so that even a stone would show pity.\"")); } }
protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(GetDescriptionBlock("Hyperlink Inlines", "The example shows how to use hyperlinks inlines.", 1)); // Hyperlink inline with a hyperlink to an URL { NHyperlinkInline hyperlinkInline = new NHyperlinkInline(); hyperlinkInline.Hyperlink = new NUrlHyperlink("http://www.nevron.com", ENUrlHyperlinkTarget.SameWindowSameFrame); hyperlinkInline.Text = "Jump to www.nevron.com"; NParagraph paragraph = new NParagraph(); paragraph.Inlines.Add(hyperlinkInline); section.Blocks.Add(paragraph); } // Image inline with a hyperlink to an URL { NImageInline imageInline = new NImageInline(); imageInline.Image = Nov.Diagram.NResources.Image_Other_MyDrawLogo_png; imageInline.Hyperlink = new NUrlHyperlink("http://www.mydraw.com", ENUrlHyperlinkTarget.SameWindowSameFrame); NParagraph paragraph = new NParagraph(); paragraph.Inlines.Add(imageInline); section.Blocks.Add(paragraph); } for (int i = 0; i < 10; i++) { section.Blocks.Add(new NParagraph("Some paragraph")); } // Bookmark inline { NParagraph paragraph = new NParagraph(); NBookmarkInline bookmark = new NBookmarkInline(); bookmark.Name = "MyBookmark"; bookmark.Text = "This is a bookmark"; bookmark.Fill = new NColorFill(NColor.Red); paragraph.Inlines.Add(bookmark); section.Blocks.Add(paragraph); } }
protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(GetDescriptionBlock("Bullet Lists", "Bullet lists allow you to apply automatic numbering on paragraphs or groups of blocks.", 1)); section.Blocks.Add(GetDescriptionBlock("Simple bullet list", "Following is a bullet list with default formatting.", 2)); CreateSampleBulletList(section, ENBulletListTemplateType.Bullet, 3, "Bullet List Item"); // setting bullet list template type { section.Blocks.Add(GetDescriptionBlock("Bullet Lists with Different Template", "Following are bullet lists with different formatting", 2)); ENBulletListTemplateType[] values = NEnum.GetValues <ENBulletListTemplateType>(); string[] names = NEnum.GetNames <ENBulletListTemplateType>(); for (int i = 0; i < values.Length - 1; i++) { CreateSampleBulletList(section, values[i], 3, names[i] + " bullet list item "); } } // nested bullet lists { section.Blocks.Add(GetDescriptionBlock("Bullet List Levels", "Following is an example of bullet list levels", 2)); NBulletList bulletList = new NBulletList(ENBulletListTemplateType.Decimal); m_RichText.Content.BulletLists.Add(bulletList); for (int i = 0; i < 3; i++) { NParagraph par1 = new NParagraph("Bullet List Item" + i.ToString()); par1.SetBulletList(bulletList, 0); section.Blocks.Add(par1); for (int j = 0; j < 2; j++) { NParagraph par2 = new NParagraph("Nested Bullet List Item" + i.ToString()); par2.SetBulletList(bulletList, 1); par2.MarginLeft = 20; section.Blocks.Add(par2); } } } }
protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(GetDescriptionBlock("Paragraphs can contain explicit line breaks", "This example shows how to programmatically add line breaks to paragraphs", 2)); NParagraph paragraph = new NParagraph(); paragraph.Inlines.Add(new NTextInline("This text appears on the first line.")); paragraph.Inlines.Add(new NLineBreakInline()); paragraph.Inlines.Add(new NTextInline("This text appears on the second line (after the line break).")); section.Blocks.Add(paragraph); }
protected override void PopulateRichText() { // Create some text NDocumentBlock documentBlock = m_RichText.Content; documentBlock.Layout = ENTextLayout.Print; NSection section = new NSection(); documentBlock.Sections.Add(section); NParagraph paragraph = new NParagraph(); paragraph.Inlines.Add(CreateMailMergeField(new NGreetingLineFieldValue())); section.Blocks.Add(paragraph); paragraph = new NParagraph(); paragraph.Inlines.Add(new NTextInline("We would like to offer you a unique software component that will help you leverage multiple platforms with single code base. We believe that as a ")); paragraph.Inlines.Add(CreateMailMergeField(new NMailMergeSourceFieldValue("Title"))); paragraph.Inlines.Add(new NTextInline(" in your company you will be very interested in this solution. If that's the case do not hesitate to contact us in order to arrange a meeting in ")); paragraph.Inlines.Add(CreateMailMergeField(new NMailMergePredefinedFieldValue(ENMailMergeDataField.City))); paragraph.Inlines.Add(new NTextInline(".")); section.Blocks.Add(paragraph); paragraph = new NParagraph(); paragraph.Inlines.Add(new NTextInline("Best Regards,")); paragraph.Inlines.Add(new NLineBreakInline()); paragraph.Inlines.Add(new NTextInline("Nevron Software")); paragraph.Inlines.Add(new NLineBreakInline()); paragraph.Inlines.Add(new NHyperlinkInline("www.nevron.com", "https://www.nevron.com")); section.Blocks.Add(paragraph); // Load a mail merge data source from resource Stream stream = NResources.Instance.GetResourceStream("RSTR_Employees_csv"); NMailMergeDataSource dataSource = NDataSourceFormat.Csv.LoadFromStream(stream, new NDataSourceLoadSettings(null, null, true)); // Create the field mappings NMailMergeFieldMap fieldMap = new NMailMergeFieldMap(); fieldMap.Set(ENMailMergeDataField.CourtesyTitle, "TitleOfCourtesy"); fieldMap.Set(ENMailMergeDataField.FirstName, "FirstName"); fieldMap.Set(ENMailMergeDataField.LastName, "LastName"); fieldMap.Set(ENMailMergeDataField.City, "City"); dataSource.FieldMap = fieldMap; documentBlock.MailMerge.DataSource = dataSource; }
public override NDocumentBlock CreateDocument() { NDocumentBlock document = base.CreateDocument(); NSection section = document.Sections[0]; // Add bullet lists of all unordered types ENBulletListTemplateType[] bulletTypes = new ENBulletListTemplateType[] { ENBulletListTemplateType.Bullet }; for (int i = 0; i < bulletTypes.Length; i++) { NBulletList bulletList = new NBulletList(ENBulletListTemplateType.Bullet); document.BulletLists.Add(bulletList); for (int j = 1; j <= 3; j++) { NParagraph paragraph = new NParagraph("This is parargaph number " + j.ToString() + ". This paragraph is contained in a bullet list of type " + bulletTypes[i].ToString()); paragraph.SetBulletList(bulletList, 0); section.Blocks.Add(paragraph); } } // Add bullet lists of all ordered types bulletTypes = new ENBulletListTemplateType[] { ENBulletListTemplateType.Decimal, ENBulletListTemplateType.LowerAlpha, ENBulletListTemplateType.LowerRoman, ENBulletListTemplateType.UpperAlpha, ENBulletListTemplateType.UpperRoman }; for (int i = 0; i < bulletTypes.Length; i++) { section.Blocks.Add(new NParagraph()); NBulletList bulletList = new NBulletList(bulletTypes[i]); for (int j = 1; j <= 3; j++) { NParagraph paragraph = new NParagraph("Bullet List Item " + j.ToString(), bulletList, 0); section.Blocks.Add(paragraph); for (int z = 1; z <= 3; z++) { NParagraph par2 = new NParagraph("Bullet List Sub Item " + z.ToString(), bulletList, 1); section.Blocks.Add(par2); } } } return(document); }
/// <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); } }
private NWidget CreateRTFDemo() { NStackPanel stack = new NStackPanel(); stack.FillMode = ENStackFillMode.Last; stack.FitMode = ENStackFitMode.Last; NButton setButton = new NButton("Set Clipboard RTF"); setButton.Click += new Function <NEventArgs>(OnSetRTFButtonClick); NButton getButton = new NButton("Get Clipboard RTF"); getButton.Click += new Function <NEventArgs>(OnGetRTFButtonClick); NPairBox pairBox = new NPairBox(setButton, getButton); pairBox.HorizontalPlacement = ENHorizontalPlacement.Left; pairBox.Spacing = NDesign.HorizontalSpacing; stack.Add(pairBox); // Create a rich text view and some content m_RichText = new NRichTextView(); m_RichText.PreferredSize = new NSize(400, 300); NSection section = new NSection(); m_RichText.Content.Sections.Add(section); NTable table = new NTable(2, 2); table.AllowSpacingBetweenCells = false; section.Blocks.Add(table); for (int i = 0; i < 4; i++) { NTableCell cell = table.Rows[i / 2].Cells[i % 2]; cell.Border = NBorder.CreateFilledBorder(NColor.Black); cell.BorderThickness = new NMargins(1); NParagraph paragraph = (NParagraph)cell.Blocks[0]; paragraph.Inlines.Add(new NTextInline("Cell " + (i + 1).ToString(CultureInfo.InvariantCulture))); } stack.Add(m_RichText); return(stack); }
public virtual NDocumentBlock CreateDocument() { NDocumentBlock document = new NDocumentBlock(); document.Information.Title = m_Title; NSection section = new NSection(); document.Sections.Add(section); NParagraph heading = new NParagraph(m_Title); section.Blocks.Add(heading); heading.HorizontalAlignment = ENAlign.Center; heading.FontSize = 24; return(document); }
protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); m_RichText.Content.Layout = ENTextLayout.Print; section.Blocks.Add(GetDescriptionBlock("Page Breaks", "The example shows how to add page break inlines.", 1)); // paragraphs with different horizontal alignment section.Blocks.Add(GetTitleParagraph("Paragraphs can contain explicit page breaks", 2)); for (int i = 0; i < 23; i++) { if (i % 10 == 0) { section.Blocks.Add(GetParagraphWithPageBreak()); } else { section.Blocks.Add(GetParagraphWithoutPageBreak()); } } section.Blocks.Add(GetTitleParagraph("Tables can also contain page breaks", 2)); NTable table = new NTable(3, 3); for (int row = 0; row < table.Rows.Count; row++) { for (int col = 0; col < table.Columns.Count; col++) { // by default cells contain a single paragraph table.Rows[row].Cells[col].Blocks.Clear(); table.Rows[row].Cells[col].Blocks.Add(GetParagraphWithoutPageBreak()); } } table.Rows[1].Cells[1].Blocks.Clear(); table.Rows[1].Cells[1].Blocks.Add(GetParagraphWithPageBreak()); section.Blocks.Add(table); }
private void OnSetRTFButtonClick(NEventArgs args) { NDataObject dataObject = new NDataObject(); using (MemoryStream stream = new MemoryStream()) { m_RichText.SaveToStream(stream, new NRtfTextFormat()); dataObject.SetData(NDataFormat.RTFFormat, stream.ToArray()); NClipboard.SetDataObject(dataObject); } // Clear the rich text m_RichText.Content.Sections.Clear(); NSection section = new NSection(); m_RichText.Content.Sections.Add(section); section.Blocks.Add(new NParagraph("Rich text content moved to clipboard.")); }
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); }
/// <summary> /// /// </summary> protected override void PopulateRichText() { NSection section = new NSection(); m_RichText.Content.Sections.Add(section); m_RichText.Content.Layout = ENTextLayout.Print; section.Blocks.Add(GetDescriptionBlock("Block Paging Control", "For each block in the control you can specify whether it starts on a new page or whether it has to avoid page breaks", 1)); section.Blocks.Add(GetDescriptionBlock("PageBreakBefore and PageBreakAfter", "The following paragraphs have PageBreakBefore and PageBreakAfter set to true", 2)); NParagraph paragraph1 = CreateSampleParagraph1("Page break must appear before this paragraph."); paragraph1.PageBreakBefore = true; section.Blocks.Add(paragraph1); NParagraph paragraph2 = CreateSampleParagraph1("Page break must appear after this paragraph."); paragraph2.PageBreakAfter = true; section.Blocks.Add(paragraph2); }