Example #1
0
        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);
            }
            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);
            }
        private void OnTestListBoxItemSelected(NSelectEventArgs <NListBoxItem> arg1)
        {
            NListBoxItem selectedItem = arg1.Item;

            if (selectedItem == null)
            {
                return;
            }

            NRichTextToHtmlExample example = selectedItem.Tag as NRichTextToHtmlExample;

            if (example == null)
            {
                return;
            }

            // Recreate the content of the Nevron rich text widget
            NDocumentBlock documentRoot = example.CreateDocument();

            NRichTextDocument document = new NRichTextDocument();

            document.Content = documentRoot;
            document.Evaluate();

            m_RichText.Document = document;
            ExportToHtml();
        }
        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;

            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("."));
        }
            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);
            }
Example #9
0
        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;
        }
Example #10
0
            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);
            }
Example #11
0
        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);
        }
Example #12
0
        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);
        }
Example #13
0
            public override NDocumentBlock CreateDocument()
            {
                NDocumentBlock document = base.CreateDocument();

                NSection   section = document.Sections[0];
                NParagraph p       = new NParagraph("This is a red paragraph on the left.");

                p.HorizontalAnchor         = ENHorizontalAnchor.Ancestor;
                p.HorizontalBlockAlignment = ENHorizontalBlockAlignment.Left;
                p.VerticalAnchor           = ENVerticalAnchor.Ancestor;
                p.XOffset        = 20;
                p.YOffset        = 200;
                p.PreferredWidth = NMultiLength.NewPercentage(25);
                p.BackgroundFill = new NColorFill(NColor.Red);
                section.Blocks.Add(p);

                p = new NParagraph("This is a green paragraph on the top.");
                p.HorizontalAnchor       = ENHorizontalAnchor.Ancestor;
                p.VerticalAnchor         = ENVerticalAnchor.Ancestor;
                p.VerticalBlockAlignment = ENVerticalBlockAlignment.Top;
                p.XOffset        = 120;
                p.YOffset        = 100;
                p.PreferredWidth = NMultiLength.NewPercentage(50);
                p.BackgroundFill = new NColorFill(NColor.Green);
                section.Blocks.Add(p);

                p = new NParagraph("This is a blue paragraph on the right.");
                p.HorizontalAnchor         = ENHorizontalAnchor.Ancestor;
                p.HorizontalBlockAlignment = ENHorizontalBlockAlignment.Right;
                p.VerticalAnchor           = ENVerticalAnchor.Ancestor;
                p.XOffset        = 20;
                p.YOffset        = 200;
                p.PreferredWidth = NMultiLength.NewPercentage(25);
                p.BackgroundFill = new NColorFill(NColor.Blue);
                p.Fill           = new NColorFill(NColor.White);
                section.Blocks.Add(p);

                return(document);
            }
        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;
        }