The example demonstrates how to programmatically create a sample report.

| Language: C# |
using Nevron.Nov;
using Nevron.Nov.Chart;
using Nevron.Nov.Dom;
using Nevron.Nov.Graphics;
using Nevron.Nov.Layout;
using Nevron.Nov.Text;
using Nevron.Nov.UI;
using Nevron.Nov.Windows.Forms;
using System.Windows.Forms;
namespace NovWinFormsProject
{
public partial class Form1 : Form
{
#region Constructors
public Form1()
{
InitializeComponent();
// Set form title
Text = "NOV WinForms - NSampleReport1Example";
// Create the NOV example and its controls
NWidget exampleContent = CreateExampleContent();
NWidget exampleControls = CreateExampleControls();
if (exampleControls != null)
{
exampleControls.PreferredWidth = 300;
}
// Place the example and its controls in a pair box
NPairBox pairBox = new NPairBox(exampleContent, exampleControls);
pairBox.FillMode = ENStackFillMode.First;
pairBox.FitMode = ENStackFitMode.First;
pairBox.Margins = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);
// Host the example in the form
NNovWidgetHost host = new NNovWidgetHost(pairBox);
host.Dock = DockStyle.Fill;
Controls.Add(host);
}
#endregion
#region Example
private NWidget CreateExampleContent()
{
return null;
}
private NWidget CreateExampleControls()
{
return null;
}
#endregion
#region Implementation
///
/// Creates a table cell with border
///
///
private NTableCell CreateTableCellWithBorder()
{
NTableCell tableCell = new NTableCell();
tableCell.Border = NBorder.CreateFilledBorder(NColor.Black);
tableCell.BorderThickness = new NMargins(1);
return tableCell;
}
///
/// Creates a section title paragraph
///
///
///
private NParagraph CreateTitleParagraph(string text)
{
NParagraph paragraph = new NParagraph();
NTextInline textInline = new NTextInline();
textInline.Text = text;
textInline.FontSize = 14;
textInline.Fill = new NColorFill(NColor.FromRGB(89, 76, 46));
paragraph.Inlines.Add(textInline);
return paragraph;
}
///
/// Creates a content paragraph
///
///
private NParagraph CreateContentParagraph(string text)
{
NParagraph paragraph = new NParagraph(text);
paragraph.HorizontalAlignment = ENAlign.Justify;
return paragraph;
}
///
/// Creates a sample bar chart given title, values and labels
///
///
///
///
///
///
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.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;
}
protected NChartView CreateCartesianChartView()
{
NChartView chartView = new NChartView();
chartView.Surface.CreatePredefinedChart(ENPredefinedChartType.Cartesian);
return chartView;
}
#endregion
#region Event Handlers
#endregion
#region Fields
private NRichTextView m_RichText;
#endregion
#region Static Methods
#endregion
#region Constants
#endregion
#region Nested Types
#endregion
}
}