/// <summary> /// Creates a paragraph that contains a widget /// </summary> /// <param name="widget"></param> /// <returns></returns> NParagraph CreateWidgetParagraph(NWidget widget) { NParagraph paragraph = new NParagraph(); NWidgetInline inline = new NWidgetInline(); inline.Content = widget; paragraph.Inlines.Add(inline); return(paragraph); }
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(".")); }
/// <summary> /// Creates a sample bar chart given title, values and labels /// </summary> /// <param name="size"></param> /// <param name="title"></param> /// <param name="values"></param> /// <param name="labels"></param> /// <returns></returns> private NParagraph CreateSampleBarChart(NSize size, string title, double[] values, string[] labels) { NChartView chartView = CreateCartesianChartView(); chartView.PreferredSize = size; // configure title chartView.Surface.Titles[0].Text = title; chartView.Surface.Titles[0].Margins = NMargins.Zero; chartView.Surface.Legends[0].Visibility = ENVisibility.Hidden; chartView.BorderThickness = NMargins.Zero; // configure chart NCartesianChart chart = (NCartesianChart)chartView.Surface.Charts[0]; chart.Padding = new NMargins(20); // configure axes chart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XOrdinalYLinear); chart.Margins = NMargins.Zero; NBarSeries bar = new NBarSeries(); bar.LegendView.Mode = ENSeriesLegendMode.None; bar.DataLabelStyle = new NDataLabelStyle(false); chart.Series.Add(bar); for (int i = 0; i < values.Length; i++) { bar.DataPoints.Add(new NBarDataPoint(values[i])); } NOrdinalScale scaleX = (NOrdinalScale)chart.Axes[ENCartesianAxis.PrimaryX].Scale; scaleX.Labels.TextProvider = new NOrdinalScaleLabelTextProvider(labels); NParagraph paragraph = new NParagraph(); NWidgetInline chartInline = new NWidgetInline(); chartInline.Content = chartView; paragraph.Inlines.Add(chartInline); return(paragraph); }