0% found this document useful (0 votes)
22 views683 pages

Step by Step Reports Creation

The document is a user guide for Report Sharp-Shooter, detailing the step-by-step process for creating various report templates using the software. It covers topics such as simple reports, data binding, and advanced features like charts and subreports. Each section provides detailed instructions for users to follow in order to design and implement their reports effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views683 pages

Step by Step Reports Creation

The document is a user guide for Report Sharp-Shooter, detailing the step-by-step process for creating various report templates using the software. It covers topics such as simple reports, data binding, and advanced features like charts and subreports. Each section provides detailed instructions for users to follow in order to design and implement their reports effectively.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 683

Report Sharp-Shooter

Step-By-Step Reports Creation


Last modified on: June 30, 2011
PERPETUUM www.perpetuumsoft.com
software

PREFACE .................................................................................................................. 4

SIMPLE REPORT ........................................................................................................ 5

DATA BINDING........................................................................................................ 19

TABLE WIZARD ....................................................................................................... 39

USING SCRIPTS ...................................................................................................... 60

LIST....................................................................................................................... 78

HEADER AND FOOTER .............................................................................................. 98

PAGE SIZE, MULTIPAGE TEMPLATE ........................................................................... 120

BREAKING TEXT INTO PAGES................................................................................... 138

WATERMARK .......................................................................................................... 152

MASTER-DETAIL REPORT ......................................................................................... 167

CHART .................................................................................................................. 192

WIDGET ................................................................................................................ 209

ADVANCED TEXT .................................................................................................... 222

BARCODE .............................................................................................................. 237

PICTURE ................................................................................................................ 260

SHAPE................................................................................................................... 281

STYLES ................................................................................................................. 297

SORTING ............................................................................................................... 321

FILTERING ............................................................................................................. 342

GROUPING............................................................................................................. 360

HYPERLINKS AND BOOKMARKS ................................................................................ 383

TOTALS ................................................................................................................. 406

2
PERPETUUM www.perpetuumsoft.com
software

NESTED GROUP ...................................................................................................... 426

JOINT USE OF GROUPING, SORTING, FILTERING AND TOTALS .................................... 450

MANAGING SIZE .................................................................................................... 483

REPORT WITHOUT BANDS ....................................................................................... 505

PARAMETERIZED REPORT ........................................................................................ 527

MULTICOLUMN REPORT ........................................................................................... 543

HORIZONTAL LIST .................................................................................................. 562

MATRIX ................................................................................................................. 575

PIVOT TABLE ......................................................................................................... 592

SUBREPORTS ......................................................................................................... 615

MASTER REPORT .................................................................................................... 631

SIDE BY SIDE REPORT ............................................................................................ 649

USING MS CHARTS IN REPORT SHARP-SHOOTER 5.3+ ............................................... 663

3
PERPETUUM www.perpetuumsoft.com
software

Preface
This user guide contains instructions on how to create templates of the common reports
using Report Sharp-Shooter. Each article is a step by step description of the report template
design process.

This user guide is prepared by Perpetuum Software team for Report Sharp-Shooter users.

4
PERPETUUM www.perpetuumsoft.com
software

Simple Report
Template of the report displaying current date, logo and a note.

Step 1
Create new project in Microsoft Visual Studio environment. Select item New\Project from the main
menu.

Select Windows Forms Application, set name of the project – “SimpleReport”, set directory
to save the project to.

5
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\SimpleReport Properties… item in the main
menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

6
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application in the editor by double click on the “Form1.cs” in the
Solution Explorer.

Drag and drop “ReportManager” element from the Toolbox. This element stores collections
of report templates and data sources.

The component is displayed in the lower part of the window.

7
PERPETUUM www.perpetuumsoft.com
software

Step 4
In the property grid, initialize the property OwnerForm of the ReportManager component by
selecting the form it is located on.

Step 5
Double click on the reportManager1 to open ReportManager editor.

8
PERPETUUM www.perpetuumsoft.com
software

On the “Reports” tab, press button “Add” and select “InlineReportSlot”.

Step 6
Set report name in the property ReportName – “SimpleReport”.

Press button “Run Designer” in order to open Report Designer.

9
PERPETUUM www.perpetuumsoft.com
software

Step 7
Create new empty template – select item File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

10
PERPETUUM www.perpetuumsoft.com
software

Step 8
Click the “Properties” tab of the tool window in the right part of the designer.

11
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

12
PERPETUUM www.perpetuumsoft.com
software

Step 9
Press button “TextBox” on the Insert tab in the group Text.

Click on the template area to add TextBox element.

Set property Value to Now.

Select property TextFormat, press button in order to open Format Editor.

Select “Date” in the “Formats” list and “dd/MM/yy” in the “Properties” list.

13
PERPETUUM www.perpetuumsoft.com
software

Step 10
Add one more TextBox to the template. Double click on the element on the report template
and open Text Editor (editor of the property Text). Write “My first report.” in the editor.

Step 11
Press “Picture” button on the Insert tab in the group Illustration.

14
PERPETUUM www.perpetuumsoft.com
software

Click on the template area to add Picture element.

Double click Picture element on the template and open dialog to set path to the picture.
Select an image with a logo and press “Open”. Set property SizeMode = Normal.

Report template:

Step 11
Save report template and close Report Designer.

Step 12
Right click on the form and select “View Code” in the context menu in order to view code.

15
PERPETUUM www.perpetuumsoft.com
software

Add the following code to the class constructor in order to display report. Write the
RenderComplited event handler of the InlineReportSlot object.

public Form1()
{
InitializeComponent();
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 13
Get back to the application form by pressing the “Form1.cs[Design]” tab.

Place two buttons on the form (drag and drop “Button” element from the Toolbox).

16
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form and edit its Text property in the property grid. Set Text
= Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, you can use
the following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 14
Press button “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

17
PERPETUUM www.perpetuumsoft.com
software

Generated report will open with Report Viewer.

In order to edit template, close Report Viewer and press “Template” on the application form.

18
PERPETUUM www.perpetuumsoft.com
software

Data Binding
Template of the report displaying information on the employee; data is loaded from the data
source.

Step 1
Create a new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set name of the project – “Data” and set directory to
save the project to.

19
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Data Properties… item in the main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

20
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application in the editor by double click on “Form1.cs” in the Solution
Explorer.

Click “DataSet” element in the Toolbox and place it onto the form.

Select “Untyped dataset”, click “OK”.

21
PERPETUUM www.perpetuumsoft.com
software

The component is displayed in the lower part of the window.

Step 4
Select dataSet1 component in the form editor. On the property grid, select “Tables”
property, press button in order to open Tables Collection Editor.

Press button “Add” in order to add a table. Set property TableName = Employee.

22
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select “Columns” property, press button in order to open property editor. Press “Add” to
add a new column. Add four columns. Set value of the property ColumnName to
“FirstName”, “LastName”, “Title”, “Phone”, “BirthDate”, “Address” correspondingly.

23
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu in order to view code.

To fill a data source, add the following code to the class constructor:

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["FirstName"] = "Robert";
row["LastName"] = "King";
row["Title"] = "Sales Representative";
row["Phone"] = "(71)555-5598";
row["BirthDate"] = "29.05.1960";
row["Address"] = "UK, London, Edgeham Hollow Winchester Way";
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click “ReportManager” element on the Toolbox and place it onto the form. This element is
designed to store collections of report templates and data sources.

24
PERPETUUM www.perpetuumsoft.com
software

Component is displayed in the lower part of the window.

Step 8
On the properties grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 9
Double click on the ReportManager component and open ReportManager editor.

25
PERPETUUM www.perpetuumsoft.com
software

Go to “Data sources” tab, press “Add”, set name of the data source – “Employee”, select
data source value – “dataSet1.Employee”.

26
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab of the ReportManager editor, press “Add” and select “InlineReportSlot”.

27
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report to “Data” in the ReportName property.

Click “Run Designer” in order to open template editor – Report Designer.

28
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty template – select File\New in the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

29
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

30
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

31
PERPETUUM www.perpetuumsoft.com
software

Step 14
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand band.

Set data source in the property DataSource = Employee.

Step 15
Press “Detail” button on the Insert tab in the group Container.

Click on the DataBand area to add the Detail band inside DataBand.

32
PERPETUUM www.perpetuumsoft.com
software

Step 16
Press “TextBox” button on the Insert tab in the group Text.

Click on the Detail area to add TextBox inside Detail band.

Click button “Script editor” on the toolbar to open Script editor and set Value property. Add
the following code: “dataBand1["FirstName"].ToString() + " " +
dataBand1["LastName"].ToString()”.

Step 17
Add four TextBox elements. Set Text property value to “Title”, “Birth Date”, “Address”,
“Home Phone”.

Change Detail size, size and orientation of the TextBox elements. Press Ctrl select all
TextBox elements. In order to left-align text click the “Align Middle Left” button on the
Format tab in the group Alignment.

33
PERPETUUM www.perpetuumsoft.com
software

Step 18
Go to “DataSources” tab.

34
PERPETUUM www.perpetuumsoft.com
software

Drag and drop fields “Title”, “BirthDate”, “Address”, “HomePhone” from the “dataBand1”
tree to the detail1 band. As a result TextBox elements are created. Value property will
feature script loading data from the data source. Change size of the element and right-align
text.

35
PERPETUUM www.perpetuumsoft.com
software

Step 19
Save template and close Report Designer.

Step 20
Add code responsible for displaying report to the class constructor. Write RenderComplited
event handler of InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["FirstName"] = "Robert";
row["LastName"] = "King";
row["Title"] = "Sales Representative";
row["Phone"] = "(71)555-5598";
row["BirthDate"] = "29.05.1960";
row["Address"] = "UK, London, Edgeham Hollow Winchester Way";
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 21
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

36
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 22
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

37
PERPETUUM www.perpetuumsoft.com
software

Generated report will open with Report Viewer.

In order to edit template, close Report Viewer and press “Template” on the application form.

38
PERPETUUM www.perpetuumsoft.com
software

Table Wizard
Table Wizard allows a user to create different tables in a few clicks.

Template of the report displaying information on the employee; data is loaded from the data
source.

Step 1
Create a new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set name of the project – “TableWizard” and set
directory to save the project to.

39
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\TableWizard Properties… item in the main
menu.

40
PERPETUUM www.perpetuumsoft.com
software

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

Step 3
Open main form of the application in the editor by double click on “Form1.cs” in the Solution
Explorer.

Click “DataSet” element in the Toolbox and place it onto the form.

41
PERPETUUM www.perpetuumsoft.com
software

Select “Untyped dataset”, click “OK”.

The component is displayed in the lower part of the window.

Step 4
Select dataSet1 component in the form editor. On the property grid, select “Tables”
property, press button in order to open Tables Collection Editor.

42
PERPETUUM www.perpetuumsoft.com
software

Press button “Add” in order to add a table. Set property TableName = Employee.

Step 5
Select “Columns” property, press button in order to open property editor. Press “Add” to
add a new column. Add four columns. Set value of the property ColumnName to
“FirstName”, “LastName”, “Title”, “Phone”, “BirthDate”, “Address” correspondingly.

43
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu in order to view code.

To fill a data source, add the following code to the class constructor:

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["FirstName"] = "Maria";

44
PERPETUUM www.perpetuumsoft.com
software

row["LastName"] = "Anders";
row["Title"] = "Sales Representative";
row["Phone"] = "(71)555-5598";
row["BirthDate"] = "29.05.1960";
row["Address"] = "Obere str. 57";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["FirstName"] = "Ana";
row["LastName"] = "Trujillo";
row["Title"] = "Owner";
row["Phone"] = "(5)555-4729";
row["BirthDate"] = "01.07.1971";
row["Address"] = "Avda. de la Constitution 222";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["FirstName"] = "Antonio";
row["LastName"] = "Moreno";
row["Title"] = "Owner";
row["Phone"] = "(5)555-3932";
row["BirthDate"] = "12.03.1969";
row["Address"] = "Mataderos 2312";
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click “ReportManager” element on the Toolbox and place it onto the form. This element is
designed to store collections of report templates and data sources.

45
PERPETUUM www.perpetuumsoft.com
software

Component is displayed in the lower part of the window.

Step 8
Double click on the ReportManager component and open ReportManager editor.

46
PERPETUUM www.perpetuumsoft.com
software

Go to “Data sources” tab, press “Add”, set name of the data source – “Employee”, select
data source value – “dataSet1.Employee”.

47
PERPETUUM www.perpetuumsoft.com
software

Step 9
Go to “Reports” tab of the ReportManager editor, press “Add” and select “InlineReportSlot”.

48
PERPETUUM www.perpetuumsoft.com
software

Step 10
Set name of the report to “TableWizard” in the ReportName property.

Click “Run Designer” in order to open template editor – Report Designer.

49
PERPETUUM www.perpetuumsoft.com
software

Step 11
Create new empty template – select File\New in the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

50
PERPETUUM www.perpetuumsoft.com
software

Step 12
Click the “Properties” tab of the tool window in the right part of the designer.

51
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

Step 13
Press “Table” button on the Insert tab in the Tables Container.

52
PERPETUUM www.perpetuumsoft.com
software

Step 14
Set data source in the property DataSource = Employee.

Step 15
Select the fields for displaying in the table by double-click on the "Available fields" list or by
click on the ">" button.

53
PERPETUUM www.perpetuumsoft.com
software

Click “Next >”.

Step 16
Change the properties of the selected fields in the appeared wizard window by double-click
on the edit field.

Set Field title for the “FirstName” field to “First Name”.

54
PERPETUUM www.perpetuumsoft.com
software

Set Field title for the “LastName” field to “Last Name”.

Set Width property for the “FirstName” and the “LastName” fields to “4.00”

Leave the “Column count” and the “Layout type” properties as they are. Click “Next”.

Step 17
Select the fields from the “Available fields” list to sort the table rows if the table requires
sorting. Click “Finish”.

55
PERPETUUM www.perpetuumsoft.com
software

Step 18
Check the “Layout Bands” on the “View” tab of the Ribbon panel to locate elements in a
more representative form.

Step 19
Save the template and close the Report Designer.

56
PERPETUUM www.perpetuumsoft.com
software

Step 20
Add code responsible for displaying report to the class constructor. Write RenderComplited
event handler of the InlineReportSlot object.

public Form1()
{
InitializeComponent();

DataRow row = dataTable1.NewRow();


row["FirstName"] = "Maria";
row["LastName"] = "Anders";
row["Title"] = "Sales Representative";
row["Phone"] = "(71)555-5598";
row["BirthDate"] = "29.05.1960";
row["Address"] = "Obere str. 57";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["FirstName"] = "Ana";
row["LastName"] = "Trujillo";
row["Title"] = "Owner";
row["Phone"] = "(5)555-4729";
row["BirthDate"] = "01.07.1971";
row["Address"] = "Avda. de la Constitution 222";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["FirstName"] = "Antonio";
row["LastName"] = "Moreno";
row["Title"] = "Owner";
row["Phone"] = "(5)555-3932";
row["BirthDate"] = "12.03.1969";
row["Address"] = "Mataderos 2312";
dataTable1.Rows.Add(row);

inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}

private void reportSlot_RenderCompleted(object sender, EventArgs e)


{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 21
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

57
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 22
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

58
PERPETUUM www.perpetuumsoft.com
software

The generated report will open in a Report Viewer.

In order to edit a template, close Report Viewer and press “Template” on the application
form.

59
PERPETUUM www.perpetuumsoft.com
software

Using Scripts
The template of a report contains numbers from 1 to 12 in the form of dial. The orientation
of TextBox element can be changed with the help of scripts depending on line number.

Step 1
Create a new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set the project name – “Script”, and directory to save
the project to.

60
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Script Properties… item in the main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

61
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open the main form of the application in the editor by double click on “Form1.cs” in the
Solution Explorer.

Drag and drop the “ReportManager” component from the Toolbox onto the form. This
component is used to store collections of report templates and data sources.

The component is displayed in the lower part of the window.

62
PERPETUUM www.perpetuumsoft.com
software

Step 4
On the property grid, initialize the OwnerForm property of the ReportManager component
by selecting a form on which it is located.

Step 5
Double click on reportManager1 and open the ReportManager editor.

63
PERPETUUM www.perpetuumsoft.com
software

Click the “Add” button on the “Reports” tab and select “InlineReportSlot”.

Step 6
Set the report name in the ReportName – “Script” property.

Click “Run Designer” to open the Report Designer template editor.

64
PERPETUUM www.perpetuumsoft.com
software

Step 7
Create a new empty template – select the File\New item in the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

65
PERPETUUM www.perpetuumsoft.com
software

Step 8
Click the “Properties” tab of the tool window in the right part of the designer.

66
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

67
PERPETUUM www.perpetuumsoft.com
software

Step 9
To open Script Browser press the “Script Browser” button in the Home tab in the Scripts
group.

Right-click on Document1 in the DocumentTree. Select CommonScript in appeared context


menu.

Write the following code in the opened window:

“private int R = 3;
private int a = 8;
private int b = 8;
private int y = 4;”

Click the “Save all” button and close the Script Browser.

Step 10
Press the “DataBand” button in the Insert tab in the group Container.

68
PERPETUUM www.perpetuumsoft.com
software

Click on the template area to add DataBand band.

Set property InstanceCount = 7.

Step 11
Press the “Detail” button in the Insert tab in the group Container.

Click on the DataBand area to add the Detail band inside DataBand.

Step 12
Press the “TextBox” button in the Insert tab in the group Text.

Click on the Detail area to add TextBox inside Detail band.

Add one more TextBox in the same way.

Step 13
To open Script Browser press the “Script Browser” button in the Home tab in the Scripts
group.

69
PERPETUUM www.perpetuumsoft.com
software

Right-click on textBox1 in the DocumentTree. Select Bindings\Value in appeared context


menu.

Write the following code in the opened window: “dataBand1.LineNumber – 1”.

Right-click on textBox1 in the DocumentTree. Select Bindings\Location in appeared context


menu.

70
PERPETUUM www.perpetuumsoft.com
software

Write the following code in the opened window:

“new PerpetuumSoft.Framework.Drawing.Vector(Math.Sqrt(R*R - (y - b) * (y - b)) + a,


0).ConvertUnits(Unit.Centimeter,Unit.InternalUnit)”

Step 14
In the same way, set the Value property to “13 - dataBand1.LineNumber”, Location
property – “new PerpetuumSoft.Framework.Drawing.Vector(-Math.Sqrt(R*R - (y - b) * (y -
b)) + a, 0).ConvertUnits(Unit.Centimeter,Unit.InternalUnit)” to TextBox2.

Click the “Save all” button and close the Script Browser.

Step 15
Select the Detail band. Click the “Properties” button in the Properties tab.

71
PERPETUUM www.perpetuumsoft.com
software

Edit band size: Size: Y = 0 cm.

Step 16
Now it is necessary to modify TextBoxes appearance.

Select both TextBoxes. Set the Size property: X = 1 cm, Y = 0,5 cm.

Select the Fill property in the “Properties” tab, click the button. Select SolidFill, Color =
Black property.

72
PERPETUUM www.perpetuumsoft.com
software

Select the TextFill property in the “Properties” tab, click the button. Select “SolidFill”,
Color = White property.

The report template looks as follows:

Step 17
Save the template and close Report Designer.

Step 18
Right click on the form and select “View Code” in the context menu to view code.

73
PERPETUUM www.perpetuumsoft.com
software

Add code for report display to the class constructor. Write the RenderComplited event
handler of the InlineReportSlot object.

public Form1()
{
InitializeComponent();
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 19
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Add two buttons onto the form (drag and drop the “Button” element from the Toolbox onto
the form).

74
PERPETUUM www.perpetuumsoft.com
software

Select the Button element in the form; edit the Text property in the property grid. Set Text
= Template for the first button and Text = Report for the second one.

Create the Click event handlers for the buttons – double click on the Button element in the
form. Add code, which launches the report generation, to the event handler. For example,
use the following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 20
Click “Start Debugging” in the Visual Studio toolbar in order to run the application.

Click the “Report” button in the opened application window.

75
PERPETUUM www.perpetuumsoft.com
software

The generated report can be opened with Report Viewer.

In order to edit the template, close Report Viewer and press “Template” in the application
form.

76
PERPETUUM www.perpetuumsoft.com
software

Similar sample can be found in the Samples Center – Scripting & Binding\Location changing.

77
PERPETUUM www.perpetuumsoft.com
software

List
Template of a report containing a list of customers including company address, contact
person and phone.

Step 1
Create a new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “List”, set directory to save the
project to.

78
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\List Properties… item in the main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

79
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

80
PERPETUUM www.perpetuumsoft.com
software

Select “Untyped dataset”, click “OK”

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

Click “Add” in order to add table. Set property TableName = Customers.

81
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select Columns property, click button in order to open property editor.

Click “Add” to add a new column. Add four columns. Set ColumnName property to
“CompanyName”, “Address”, “ContactName”, “Phone” correspondingly.

82
PERPETUUM www.perpetuumsoft.com
software

Close the editors.

Step 6
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor in order to fill data source.

public Form1()
{
InitializeComponent();

83
PERPETUUM www.perpetuumsoft.com
software

DataRow row = dataTable1.NewRow();


row["CompanyName"] = "Alfreds Futterkiste";
row["Address"] = "Obere Str. 57";
row["ContactName"] = "Maria Anders";
row["Phone"] = "030-0074321";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["Address"] = "Avda. de la Constitución 2222";
row["ContactName"] = "Ana Trujillo";
row["Phone"] = "(5) 555-4729";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["Address"] = "Kirchgasse 6";
row["ContactName"] = "Roland Mendel";
row["Phone"] = "7675-3425";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["Address"] = "Luisenstr. 48";
row["ContactName"] = "Karin Josephs";
row["Phone"] = "0251-031259";
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

84
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 8
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 9
Double click on ReportManager to open ReportManager editor.

85
PERPETUUM www.perpetuumsoft.com
software

Go to “Data sources” tab, click “Add”, set data source name – “Customers”, select data
source value – “dataSet1.Customers”.

86
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

87
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in the property ReportName – “List”.

Click “Run Designer” in order to open template editor – Report Designer.

88
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

89
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

90
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

91
PERPETUUM www.perpetuumsoft.com
software

Step 14
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand band.

Set data source in the property DataSource = Customers.

Step 15
Press “Detail” button on the Insert tab in the group Container.

Click on the DataBand area to add the Detail band inside DataBand.

92
PERPETUUM www.perpetuumsoft.com
software

Step 16
Go to “Data Source” tab.

93
PERPETUUM www.perpetuumsoft.com
software

Drag and drop fields: “Company Name”, “Address”, “Contact Name”, and “Phone” from the
dataBand1 tree to the detail1 band. As a result TextBoxes are created. Value property is
automatically filled with script loading data from the data source.

Change size of the elements and locate them in the way shown in the picture below.

94
PERPETUUM www.perpetuumsoft.com
software

Step 17
Save template, close Report Designer.

Step 18
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["Address"] = "Obere Str. 57";
row["ContactName"] = "Maria Anders";
row["Phone"] = "030-0074321";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["Address"] = "Avda. de la Constitución 2222";
row["ContactName"] = "Ana Trujillo";
row["Phone"] = "(5) 555-4729";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["Address"] = "Kirchgasse 6";
row["ContactName"] = "Roland Mendel";
row["Phone"] = "7675-3425";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["Address"] = "Luisenstr. 48";
row["ContactName"] = "Karin Josephs";
row["Phone"] = "0251-031259";
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 19
Place two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

95
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 20
Click “Start Debugging” on the Visual Studio toolbar in order to run application.

Click the “Report” button in the opened application window.

96
PERPETUUM www.perpetuumsoft.com
software

Generated report will open with Report Viewer.

In order to edit template, close Report Viewer and press “Template” on the application form.

Similar application sample is located in the following folder “Samples\Report Sharp-


Shooter\CSharp\GettingStartedExample”.

97
PERPETUUM www.perpetuumsoft.com
software

Header and Footer


Template of a report containing list of companies with additional information, each column
has header and footer.

Step 1
Create a new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Header_Footer”, set directory to
save project to.

98
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Header_Footer Properties… item in the
main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

99
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application in the editor by double click on the “Form1.cs” in the
Solution Explorer.

Click “DataSet” element on the Toolbox and place it onto the form.

Select “Untyped dataset”, click “OK”.

100
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
Select dataSet1 component in the form editor. On the property grid, select Tables property,
click button in order to open property editor.

Click “Add” to add a table. Set property TableName = Customers.

101
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select Columns property, click button in order to open property editor.

Click “Add” to add new column. Add four columns. Set ColumnName property to
“CompanyName”, “Address”, “ContactName”, “Phone”.

102
PERPETUUM www.perpetuumsoft.com
software

Close the editors.

Step 6
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor to fill the data source.

public Form1()
{
InitializeComponent();

103
PERPETUUM www.perpetuumsoft.com
software

DataRow row = dataTable1.NewRow();


row["CompanyName"] = "Alfreds Futterkiste";
row["Address"] = "Obere Str. 57";
row["ContactName"] = "Maria Anders";
row["Phone"] = "030-0074321";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["Address"] = "Avda. de la Constitución 2222";
row["ContactName"] = "Ana Trujillo";
row["Phone"] = "(5) 555-4729";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["Address"] = "Kirchgasse 6";
row["ContactName"] = "Roland Mendel";
row["Phone"] = "7675-3425";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["Address"] = "Luisenstr. 48";
row["ContactName"] = "Karin Josephs";
row["Phone"] = "0251-031259";
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking “Form1.cs[Design]” tab.

Click “ReportManager” element on the Toolbox and place the component onto the form. This
component is designed to store collections of data sources and report templates.

104
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 8
On the property grid, initialize the OwnerForm property of the ReportManager element by
selecting the form it is located on.

Step 9
Double click on the ReportManager and open ReportManager editor.

105
PERPETUUM www.perpetuumsoft.com
software

Go to the “Data sources” tab, click “Add”, set name of the data source to “Customers”,
select data source value to “dataSet1.Customers”.

106
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

107
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in the property ReportName – “Header_Footer”.

Click “Run Designer” to open template editor Report Designer.

108
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

109
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

110
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

111
PERPETUUM www.perpetuumsoft.com
software

Step 14
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand band.

Set data source in the property DataSource = Customers.

Step 15
Press “Header” button on the Insert tab in the group Container.

Click on the DataBand area to add Header band inside the DataBand.

Set property RepeatEveryPage to “True”.

112
PERPETUUM www.perpetuumsoft.com
software

Step 16
Press button “TextBox” on the Insert tab in the group Text.

Click on the Header band area to TextBox inside Header. In the same way add another
three TextBox elements. Double click on the TextBox to open Text editor – editor of the
Text property. Set Text property to: “Company”, “Address”, “Contact”, and “Phone”.

Step 17
Press “Detail” button on the Insert tab in the group Container.

113
PERPETUUM www.perpetuumsoft.com
software

Click on the DataBand area to add the Detail band inside DataBand.

Step 18
Go to “DataSources” tab.

114
PERPETUUM www.perpetuumsoft.com
software

Drag and drop fields “CompanyName”, “Address”, “ContactName”, “Phone” from the
dataBand1 to the detail1 band. As a result TextBox elements will be created. Script loading
data from the data source will be added to the Value property.

Change size of the elements and locate them in the following way:

115
PERPETUUM www.perpetuumsoft.com
software

Step 19
Press “Footer” button on the Insert tab in the group Container.

Click on the DataBand area to add Footer inside the DataBand.

Step 20
Press Shift key and select all TextBox elements from the Header. Open context menu by
right click on any of the selected elements and select “Copy Objects”.

Select Footer band, open context menu by right click on the Footer band, select “Paste
Objects”.

Report template should look in the following way:

Step 21
Save template, close Report Designer.

116
PERPETUUM www.perpetuumsoft.com
software

Step 22
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["Address"] = "Obere Str. 57";
row["ContactName"] = "Maria Anders";
row["Phone"] = "030-0074321";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["Address"] = "Avda. de la Constitución 2222";
row["ContactName"] = "Ana Trujillo";
row["Phone"] = "(5) 555-4729";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["Address"] = "Kirchgasse 6";
row["ContactName"] = "Roland Mendel";
row["Phone"] = "7675-3425";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["Address"] = "Luisenstr. 48";
row["ContactName"] = "Karin Josephs";
row["Phone"] = "0251-031259";
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 23
Place two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

117
PERPETUUM www.perpetuumsoft.com
software

Select Button on the form, edit Text property on the property grid. Set Text = Template for
one button and Text = Report for the second one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 24
Click “Start Debugging” on the Visual Studio toolbar in order to run application.

Click the “Report” button in the opened application window.

118
PERPETUUM www.perpetuumsoft.com
software

Generated report will open with Report Viewer.

In order to edit template, close Report Viewer and press “Template” on the application form.

Similar application sample is located in the following folder “Samples\Report Sharp-


Shooter\CSharp\Simple List”.

Similar sample in the Samples Center is Reports\Simple Reports\List.

119
PERPETUUM www.perpetuumsoft.com
software

Page Size, Multipage Template


Template of a report containing two pages of different size. Each page contains information
on page number and size.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Page”, set directory to save the
project to.

120
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Page Properties… item in the main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

121
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

122
PERPETUUM www.perpetuumsoft.com
software

Step 4
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 5
Double click on ReportManager to open ReportManager editor.

123
PERPETUUM www.perpetuumsoft.com
software

On the “Reports” tab click “Add” and select “InlineReportSlot”.

Step 6
Set name of the report in the property ReportName – “Page”.

Click “Run Designer” to open template editor Report Designer.

124
PERPETUUM www.perpetuumsoft.com
software

Step 7
Create new empty report – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

125
PERPETUUM www.perpetuumsoft.com
software

Step 8
Click the “Properties” tab of the tool window in the right part of the designer.

126
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

127
PERPETUUM www.perpetuumsoft.com
software

Step 9
Press the button in Properties. Select the “page1 Page” item in the combo box.

You will see properties of the edited page in the “Properties” tab of Tool Window in the right
part of the designer.

Set the PaperKind = Custom property. Click the button which is located to the left from
CustomSize and set X = 10 cm; Y = 7 cm.

128
PERPETUUM www.perpetuumsoft.com
software

To make the report template preview more convenient, change zoom in the toolbar. Set
value to “150%”.

129
PERPETUUM www.perpetuumsoft.com
software

Step 10
Click the button. That is located to the left from the Margins property, set all values to
“0”.

Step 11
Press the “TextBox” button in the Insert tab in the group Text.

130
PERPETUUM www.perpetuumsoft.com
software

Click on the template area to add the TextBox element.

Click the “Script Browser” button in the Home tab in the group Scripts.

Right-click on TextBox1 in the DocumentTree. Select Bindings\Value in appeared context


menu.

In the opened window, write the following code:

131
PERPETUUM www.perpetuumsoft.com
software

"Page №" + PageNumber.ToString() + " of " + PageCount.ToString() + ". 10x7 cm".

Click the “Save all” button and close the Script Browser.

Step 12
Press the “NewPage” button in the Insert tab in the group Page to add a new template.

To switch between pages use tabs in the left lower corner.

Step 13
Go to properties of the page2. Set properties PaperKind = A5, Orientation = Landscape.

132
PERPETUUM www.perpetuumsoft.com
software

Step 14
Add the TextBox element to page2. Open Script Browser. Right click on the TextBox2 item
in the DocumeentTree. Select Bindings\Value in the appeared context menu. Add the
following script in the opened window: "Page №" + PageNumber.ToString() + " of " +
PageCount.ToString() + ". A5, Landscape."+ "Page2, zoom 100%".

Press the “Save all” button and close Script Browser.

133
PERPETUUM www.perpetuumsoft.com
software

Step 15
Save the template, close Report Designer.

Step 16
Right click on the form and select “View Code” in the context menu to view code.

134
PERPETUUM www.perpetuumsoft.com
software

To display the report, add the code to the class constructor. Write the RenderComplited
event handler of the InlineReportSlot object.

public Form1()
{
InitializeComponent();
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 17
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Add two buttons onto the form (drag and drop the “Button” element from the Toolbox onto
the form).

Select the Button element in the form, edit the Text property in the property grid. Set Text
= Template for the first button and Text = Report for the second one.

135
PERPETUUM www.perpetuumsoft.com
software

Create the Click event handlers for the buttons – double click on the Button element in the
form. Add code for report generation to the event handler. For example, use the following
code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 18
Click “Start Debugging” in the Visual Studio toolbar in order to run application.

Click the “Report” button in the opened application window.

The generated report can be opened with Report Viewer.

136
PERPETUUM www.perpetuumsoft.com
software

In order to edit the template, close Report Viewer and press “Template” in the application
form.

Similar sample can be found in the Samples Center: Reports\Special features\The use of
two pages template.

137
PERPETUUM www.perpetuumsoft.com
software

Breaking Text into Pages


Template of a report containing breaking long text into pages.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Text”, set directory to save the
project to.

138
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Text Properties… item in the main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

139
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

140
PERPETUUM www.perpetuumsoft.com
software

Step 4
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 5
Double click on ReportManager to open ReportManager editor.

141
PERPETUUM www.perpetuumsoft.com
software

Go to “Reports tab”, click “Add” and select “InlineReportSlot”.

Step 6
Set name of the report in the property ReportName – “Text”.

Click “Run Designer” in order to open template editor – Report Designer.

142
PERPETUUM www.perpetuumsoft.com
software

Step 7
Create new empty report – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

143
PERPETUUM www.perpetuumsoft.com
software

Step 8
Click the “Properties” tab of the tool window in the right part of the designer.

144
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

145
PERPETUUM www.perpetuumsoft.com
software

Step 9
Press “Detail” button on the Insert tab in the group Container.

Click on the template area to add Detail band to the template. Set CanGrow and CanBreak
properties to “True”.

Step 10
Press button “AdvancedText” on the Insert tab in the group Text.

Click on the Detail band area to add AdvancedText element inside the Detail. Dragging the
right border of the element make it fit page width. Double click on the AdvancedText band
and open Formatted text editor.

Click “Open RTF document” button. Select RTF file containing some text.

146
PERPETUUM www.perpetuumsoft.com
software

On the property grid set CanBreak and CanGrow properties to “True”.

Step 11
Save report and close Report Designer.

Step 12
Right click on the form and select “View Code” in the context menu in order to view code.

147
PERPETUUM www.perpetuumsoft.com
software

Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 13
Go to the application form by clicking the “Form1.cs[Design]” tab.

Place two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

148
PERPETUUM www.perpetuumsoft.com
software

Select Button on the form, edit Text property on the property grid. Set Text = Template for
one button and Text = Report for the second one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 14
Click “Start Debugging” on the Visual Studio toolbar in order to run application.

Click the “Report” button in the opened application window.

149
PERPETUUM www.perpetuumsoft.com
software

Generated report will open with Report Viewer.

In order to edit template, close Report Viewer and press “Template” on the application form.

150
PERPETUUM www.perpetuumsoft.com
software

151
PERPETUUM www.perpetuumsoft.com
software

Watermark
Template of a report containing main data that is located over the additional information –
product logо and name.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Watermark”, set directory to save
the project to.

152
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Watermark Properties… item in the main
menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

153
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

154
PERPETUUM www.perpetuumsoft.com
software

Step 4
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 5
Double click on ReportManager to open ReportManager editor.

155
PERPETUUM www.perpetuumsoft.com
software

Go to “Reports tab”, click “Add” and select “InlineReportSlot”.

Step 6
Set name of the report in the property ReportName – “Watermark”.

Click “Run Designer” in order to open template editor - Report Designer.

156
PERPETUUM www.perpetuumsoft.com
software

Step 7
Create new empty report – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

157
PERPETUUM www.perpetuumsoft.com
software

Step 8
Click the “Properties” tab of the tool window in the right part of the designer.

158
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

159
PERPETUUM www.perpetuumsoft.com
software

Step 9
Press “PageOverlay” button on the Insert tab in the group Page.

Click on the template area to add PageOverlay band.

Step 10
Press button “TextBox” on the Insert tab in the group Text.

Click on the PageOverlay band area to add TextBox inside PageOverlay.

Set property Text = REPORT SHARP-SHOOTER. Set property Font.Size = 48. Select TextFill
property, click button select SolidFill, Color = Grey.

160
PERPETUUM www.perpetuumsoft.com
software

Change size of the PageOverlay band and the TextBox element so that the text is visible.

161
PERPETUUM www.perpetuumsoft.com
software

Step 11
Press button “Picture” on the Insert tab in the group Illustration.

Click on the PageOverlay band area to add Picture element inside PageOverlay.

Double click on the Picture element to open dialog setting path to the picture. Select a
picture and click “Open”.

Set property SizeMode = Normal.

Change size of the PageOverlay band and Picture element so that the picture is visible.

162
PERPETUUM www.perpetuumsoft.com
software

Step 12
Save template, close Report Designer

Step 13
Right click on the form and select “View Code” in the context menu in order to view code.

Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 14
Get back to the application form by clicking the “Form1.cs[Design]” tab.

163
PERPETUUM www.perpetuumsoft.com
software

Place two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

Select Button on the form, edit Text property on the property grid. Set Text = Template for
one button and Text = Report for the second one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 15
Click “Start Debugging” on the Visual Studio toolbar in order to run application.

164
PERPETUUM www.perpetuumsoft.com
software

Click the “Report” button in the opened application window.

Generated report will open with Report Viewer.

In order to edit template, close Report Viewer and press “Template” on the application form.

165
PERPETUUM www.perpetuumsoft.com
software

Similar sample in the Samples Center is Reports\Special features\Watermarks.

166
PERPETUUM www.perpetuumsoft.com
software

Master-Detail Report
Template of a report containing a list of customers and a list of orders for every customer.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Detail”, set directory to save the
project to.

167
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Detail Properties… item in the main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

168
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

Select “Untyped dataset”, click “OK”

169
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

Click “Add” in order to add table. Set property TableName = Customers.

170
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select Columns property, click button in order to open property editor.

Click “Add” to add a new column. Add two columns. Set ColumnName property to
“CompanyName”, “CustNo”. Set DataType = System.Int32, AllowDBNull = False for the
CustNo column.

171
PERPETUUM www.perpetuumsoft.com
software

Step 6
In the Tables Collection Editor click “Add” in order to add one more table. Set TableName
property to “Orders”.

172
PERPETUUM www.perpetuumsoft.com
software

Open Columns property editor. Add four columns, set ColumnName property to “OrderID”,
“OrderDate”, “OrderSum”, “CustNo”. Set DataType = System.Int32, AllowDBNull = False for
the CustNo column.

Step 7
Select dataSet1 component in the form editor. On the property grid, select Relation
property and click button to open property editor.

Click “Add”.

173
PERPETUUM www.perpetuumsoft.com
software

In the Relation form, set “CustomersOrder” in the Name field. Select “Customers” in the
“Parent Table” and “Orders” in the “Child Table”. In the “Columns table”, set Key Columns –
“CustNo”, Foreign Key Columns – “CustNo”.

174
PERPETUUM www.perpetuumsoft.com
software

Step 8
Right click on the form and select “View Code” in the context menu in order to view code.

Add the following code in the class constructor to fill in a data source:

175
PERPETUUM www.perpetuumsoft.com
software

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CustNo"] = 1;
row["CompanyName"] = "Bon App'";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CustNo"] = 2;
row["CompanyName"] = "Chop-suey Chinese";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CustNo"] = 3;
row["CompanyName"] = "Maison Dewey";
dataTable1.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 1;
row["OrderID"] = "00001";
row["OrderDate"] = "21.03.2010";
row["OrderSum"] = "50.00";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 1;
row["OrderID"] = "00002";
row["OrderDate"] = "15.02.2010";
row["OrderSum"] = "14.50";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00010";
row["OrderDate"] = "17.04.2010";
row["OrderSum"] = "134.00";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00011";
row["OrderDate"] = "24.01.2010";
row["OrderSum"] = "45.45";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00013";
row["OrderDate"] = "14.02.2010";
row["OrderSum"] = "500.00";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00101";
row["OrderDate"] = "13.03.2010";
row["OrderSum"] = "6.03";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 3;
row["OrderID"] = "00666";
row["OrderDate"] = "06.06.2010";
row["OrderSum"] = "66.66";
dataTable2.Rows.Add(row);
}

176
PERPETUUM www.perpetuumsoft.com
software

Step 9
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

Step 10
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

177
PERPETUUM www.perpetuumsoft.com
software

Double click on ReportManager to open ReportManager editor.

Go to Data sources tab, click “Add”, set data source name – “CustomersOrder”, select data
source value – “dataSet1”.

178
PERPETUUM www.perpetuumsoft.com
software

179
PERPETUUM www.perpetuumsoft.com
software

Step 11
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

Step 12
Set name of the report in the property ReportName – “Detail”.

Click “Run Designer” in order to open template editor - Report Designer.

180
PERPETUUM www.perpetuumsoft.com
software

Step 13
Create new empty report – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

181
PERPETUUM www.perpetuumsoft.com
software

Step 14
Click the “Properties” tab of the tool window in the right part of the designer.

182
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

183
PERPETUUM www.perpetuumsoft.com
software

Step 15
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand band to the template.

Set data source in the property DataSource = CustomersOrder.Customers.

Step 16
Press “Detail” button on the Insert tab in the group Container.

184
PERPETUUM www.perpetuumsoft.com
software

Click on the DataBand area to add Detail band inside DataBand.

Step 17
Go to “DataSources” tab.

185
PERPETUUM www.perpetuumsoft.com
software

Drag and drop “CompanyName” field from the dataBand1 tree to the detail1 band. As a
result TextBoxes are created. Value property is automatically filled with script loading data
from the data source.

186
PERPETUUM www.perpetuumsoft.com
software

Step 18
Add another DataBand band to the dataBand1. Set
“CustomersOrder.Customers.CustomersOrder” as a data source in the DataSource property.

Stуз 19
Add Detail band to the dataBand2.

Step 20
On the “Data Sources” tab, drag and drop “OrderID”, “OrderDate”, “OrderSum” fields from
the dataBand2 tree to the detail2 band.

Step 21
Save template and close Report Designer.

Step 22
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CustNo"] = 1;
row["CompanyName"] = "Bon App'";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CustNo"] = 2;
row["CompanyName"] = "Chop-suey Chinese";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CustNo"] = 3;
row["CompanyName"] = "Maison Dewey";
dataTable1.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 1;
row["OrderID"] = "00001";
row["OrderDate"] = "21.03.2010";
row["OrderSum"] = "50.00";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 1;
row["OrderID"] = "00002";

187
PERPETUUM www.perpetuumsoft.com
software

row["OrderDate"] = "15.02.2010";
row["OrderSum"] = "14.50";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00010";
row["OrderDate"] = "17.04.2010";
row["OrderSum"] = "134.00";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00011";
row["OrderDate"] = "24.01.2010";
row["OrderSum"] = "45.45";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00013";
row["OrderDate"] = "14.02.2010";
row["OrderSum"] = "500.00";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00101";
row["OrderDate"] = "13.03.2010";
row["OrderSum"] = "6.03";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 3;
row["OrderID"] = "00666";
row["OrderDate"] = "06.06.2010";
row["OrderSum"] = "66.66";
dataTable2.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 23
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

188
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 24
Click “Start Debugging” on the Visual Studio toolbar in order to run application.

Click the “Report” button in the opened application window.

189
PERPETUUM www.perpetuumsoft.com
software

Generated report will open with Report Viewer.

In order to edit template, close Report Viewer and press “Template” on the application form.

190
PERPETUUM www.perpetuumsoft.com
software

Similar application sample is located in the following folder “\Perpetuum Software\Net


ModelKit Suite\ Samples\Report Sharp-Shooter\CSharp\MasterDetail”.

Similar sample in the Samples Center is Reports\Master-Detail\Master-Detail.

191
PERPETUUM www.perpetuumsoft.com
software

Chart
Template of a report containing charts for every category of goods including information on
price of the goods in this category.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Charts”, set directory to save the
project to.

192
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Charts Properties… item in the main
menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

193
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

Select “Untyped dataset”, click “OK”

194
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

Click “Add” in order to add table. Set property TableName = Products.

195
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select Columns property, click button in order to open property editor.

Click “Add” to add a new column. Add two columns. Set ColumnName properties to
“ProductName”, “UnitPrice”.

196
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu in order to view code.

Add the following code in the class constructor to fill in a data source:

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["ProductName"] = "Chai";

197
PERPETUUM www.perpetuumsoft.com
software

row["UnitPrice"] = "18";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["ProductName"] = "Chang";
row["UnitPrice"] = "19";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["ProductName"] = "Aniseed Syrup";
row["UnitPrice"] = "10";
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click on the “ReportManager”on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

Step 8
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

198
PERPETUUM www.perpetuumsoft.com
software

Step 9
Double click on ReportManager to open ReportManager editor.

Go to “Data Sources” tab and click “Add”, set data source name – “Products”, select data
source value – “dataSet1.Products”.

199
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

200
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in ReportName – “Charts”.

Click “Run Designer” to open template editor Report Designer.

201
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty report – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

202
PERPETUUM www.perpetuumsoft.com
software

Step 13
Press “ChartControl” button on the Insert tab in the group Illustration.

Click on the template area to add ChartControl to the template.

Step 14
Select ChartControl element. You will see component properties on the property grid of the
Tool Window in the right part of the editor.

Select DataSource property, click button , and select value “Products”.

203
PERPETUUM www.perpetuumsoft.com
software

Step 15
Double click on the ChartControl area to open Chart ModelKit designer. Create a chart. Find
more information on creating charts in Chart ModelKit designer in Section Chart ModelKit
hereof.

Step 16
Close Chart ModelKit designer by clicking “OK” button.

Report template should look as follows:

204
PERPETUUM www.perpetuumsoft.com
software

Step 17
Save template, close Report Designer.

Step 18
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["ProductName"] = "Chai";
row["UnitPrice"] = "18";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["ProductName"] = "Chang";
row["UnitPrice"] = "19";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["ProductName"] = "Aniseed Syrup";
row["UnitPrice"] = "10";
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs
e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm =
new PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 19
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

205
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 20
Click “Start Debugging” on the Visual Studio toolbar in order to run application.

Click the “Report” button in the opened application window.

206
PERPETUUM www.perpetuumsoft.com
software

Generated report will open with Report Viewer.

In order to edit template, close Report Viewer and press “Template” on the application form.

207
PERPETUUM www.perpetuumsoft.com
software

Similar sample in the Samples Center is Report Controls\Charts\Chart on DataBand.

208
PERPETUUM www.perpetuumsoft.com
software

Widget
Template of a report containing widget.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Widget”, set directory to save the
project to.

209
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Widget Properties… item in the main
menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

210
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

211
PERPETUUM www.perpetuumsoft.com
software

Step 4
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 5
Double click on ReportManager to open ReportManager editor.

212
PERPETUUM www.perpetuumsoft.com
software

Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

Step 6
Set name of the report in the property ReportName – “Widget”.

Click “Run Designer” in order to open template editor - Report Designer.

213
PERPETUUM www.perpetuumsoft.com
software

Step 7
Create new empty report – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

214
PERPETUUM www.perpetuumsoft.com
software

Step 8
Click the “Properties” tab of the tool window in the right part of the designer.

215
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

216
PERPETUUM www.perpetuumsoft.com
software

Step 9
Press “Detail” button on the Insert tab in the group Container.

Click on the template area to add the band to the template.

Step 10
Press “Widget” button on the Insert tab in the group Illustration.

Click on the Detail band area to add Widget component inside Detail.

Double click on the Widget element to open Instrument designer in order to design a
widget. Find more information on creating widgets in Instrument designer in Section
Instrument designer hereof.

After the Widget is created close Instrument designer by clicking “OK”

Report template should as follows:

Step 11
Save template and close Report Designer.

217
PERPETUUM www.perpetuumsoft.com
software

Step 12
Right click on the application form and select “View Code” in the context menu in order to
view code.

Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 13
Get back to application form by clicking “Form1.cs[Design]” tab.

Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

218
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 14
Click “Start Debugging” on the Visual Studio toolbar in order to run application.

Click the “Report” button in the opened application window.

219
PERPETUUM www.perpetuumsoft.com
software

Generated report will open with Report Viewer.

In order to edit template, close Report Viewer and press “Template” on the application form.

220
PERPETUUM www.perpetuumsoft.com
software

Similar sample in the Samples Center is Report Controls\Instruments\Instruments types.

221
PERPETUUM www.perpetuumsoft.com
software

Advanced Text
Template of a report containing formatted text.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “AdvancedText”, set directory to
save the project to.

222
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\AdvancedText Properties… item in the
main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

223
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click on the “ReportManager” element on the Toolbox and place this component onto the
form. This component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

224
PERPETUUM www.perpetuumsoft.com
software

Step 4
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 5
Double click on ReportManager to open ReportManager editor.

225
PERPETUUM www.perpetuumsoft.com
software

Go to “Reports tab”, click “Add” and select “InlineReportSlot”.

Step 6
Set name of the report in the property ReportName – “AdvancedText”.

Click “Run Designer” in order to open template editor - Report Designer.

226
PERPETUUM www.perpetuumsoft.com
software

Step 7
Create new empty report – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

227
PERPETUUM www.perpetuumsoft.com
software

Step 8
Click the “Properties” tab of the tool window in the right part of the designer.

228
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

229
PERPETUUM www.perpetuumsoft.com
software

Step 9
Press “AdvancedText” button on the Insert tab in the group Text.

Click on the template area to add AdvancedText to the template.

Step 10
Double click on the AdvancedText element area and open Formatted Text Editor. Add the
following text “Right align. Red color. Font Calibri, 10, Bold, Underline.” Select it.

Click those buttons “Bold”, “Underline” and “Right align”. Corresponding tags are added to
the text.

Click “Font” button to open font editor. In the Fonts list, select “Calibri”, set Size to “10”.

230
PERPETUUM www.perpetuumsoft.com
software

Click “Color” button, select red color on the Color form.

Step 11
Set cursor at the end of the text in the Formatted Text Editor. Click “Insert line break”
button.

Add several line breaks in this way.

Step 12
In the Formatted Text Editor, add the following text “Center align. Italic.” Add by double
click “Now” field from the Special Fields tree (in the Data Sources area).

Select the added text and click “Italic” and “Center align” buttons.

231
PERPETUUM www.perpetuumsoft.com
software

Step 13
Close Formatted Text Editor by clicking “OK”. Change size of the AdvancedText element so
that the text is completely visible.

Step 14
Add one more AdvancedText element. Open Formatted Text Editor. Click “Open RFT
Document” button. Select RTF file. Close editor, change size of the AdvancedText element
to view the whole text.

232
PERPETUUM www.perpetuumsoft.com
software

Step 15
Save template, close Report Designer.

Step 16
Right click on the application form and select “View Code” in the context menu in order to
view code.

Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);

233
PERPETUUM www.perpetuumsoft.com
software

}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 17
Get back to the application form by clicking “Form1.cs[Design]” tab.

Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

234
PERPETUUM www.perpetuumsoft.com
software

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 18
Click “Start Debugging” on the Visual Studio toolbar in order to run application.

Click the “Report” button in the opened application window.

Generated report will open with Report Viewer.

235
PERPETUUM www.perpetuumsoft.com
software

In order to edit template, close Report Viewer and press “Template” on the application form.

Similar sample in the Samples Center is Report Controls\Basic\Advanced text.

236
PERPETUUM www.perpetuumsoft.com
software

BarCode
Template of a report designed to print labels with bar code.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “BarCode”, set directory to save the
project to.

237
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\BarCode Properties… item in the main
menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

238
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

Select “Untyped dataset”, click “OK”.

239
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

Click “Add” in order to add table. Set property TableName = Products.

240
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select Columns property, click button in order to open property editor.

Click “Add” to add a new column. Add three columns. Set ColumnName property to
“ProductName”, “UnitPrice”, “EAN13”.

241
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor in order to fill data source.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["ProductName"] = "Chai";

242
PERPETUUM www.perpetuumsoft.com
software

row["UnitPrice"] = "18";
row["EAN13"] = "0706849000019";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["ProductName"] = "Chang";
row["UnitPrice"] = "19";
row["EAN13"] = "0706849000026";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["ProductName"] = "Aniseed Syrup";
row["UnitPrice"] = "10";
row["EAN13"] = "0706849000033";
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

243
PERPETUUM www.perpetuumsoft.com
software

Step 8
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 9
Double click on ReportManager to open ReportManager editor.

Go to “Data Sources” tab, click “Add”, set data source name – “Products”, select data
source value – “dataSet1.Products”.

244
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

245
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in the property ReportName – “BarCode”.

Click “Run Designer” in order to open template editor - Report Designer.

246
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty report – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

247
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

248
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

249
PERPETUUM www.perpetuumsoft.com
software

Step 14
Press the button in Properties. Select the “page1 Page” item in the combo box.

You will see properties of the edited page in the “Properties” tab of Tool Window in the right
part of the designer.

Set the PaperKind = Custom property. Click the button to the left from the CustomSize
property and set the following properties: X = 8,5 cm; Y = 3,5 cm.

250
PERPETUUM www.perpetuumsoft.com
software

Step 15
Press the “DataBand” button in the Insert tab in the group Container.

Click on the template area to add DataBand to the template.

Resize the component in order it is fitted the page width.

Pay attention to the zoom value – 150%. Check “Layout Bands” in the View tab in the
Show\Hide group. The “Layout Bands” option, which automatically sets size of the bands,
should be disabled.

Set DataSource = Products.

Step 16
Press the “Detail” button in the Insert tab in the group Container.

251
PERPETUUM www.perpetuumsoft.com
software

Click on the DataBand area to add Detail band inside DataBand. Change its size so that it
covers the whole DataBand area.

Step 17
Go to the “DataSources” tab.

252
PERPETUUM www.perpetuumsoft.com
software

Drag and drop the “ProductName”, “UnitPrice” fields from the dataBand1 tree to the detail1
band. Add one more TextBox element (press the “TextBox” button in the Insert tab in the
Text group).

253
PERPETUUM www.perpetuumsoft.com
software

Set property Text = “Price:”

Locate the TextBox elements in the following way:

Step 18
Press the “BarCode” button in the Insert tab in the group Illustration.

Place BarCode onto the detail1 band area. Set property CodeType = CodeEAN1.

254
PERPETUUM www.perpetuumsoft.com
software

To set Barcode code, open the Bindings properties in the “Properties” tab and set
barCode1.Code = dataBand1["EAN13"].

Report template should look as follows:

255
PERPETUUM www.perpetuumsoft.com
software

Step 19
Save template, close Report Designer.

Step 20
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["ProductName"] = "Chai";
row["UnitPrice"] = "18";
row["EAN13"] = "0706849000019";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["ProductName"] = "Chang";
row["UnitPrice"] = "19";
row["EAN13"] = "0706849000026";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["ProductName"] = "Aniseed Syrup";
row["UnitPrice"] = "10";
row["EAN13"] = "0706849000033";
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 21
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

256
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 22
Click “Start Debugging” on the Visual Studio toolbar in order to run application.

Click the “Report” button in the opened application window.

257
PERPETUUM www.perpetuumsoft.com
software

Generated report will open with Report Viewer.

In order to edit template, close Report Viewer and press “Template” on the application form.

258
PERPETUUM www.perpetuumsoft.com
software

Similar application sample is located in the following folder “\Perpetuum Software\Net


ModelKit Suite\ Samples\Report Sharp-Shooter\CSharp\LabelExample”.

Similar sample in the Samples Center is Report Controls\Basic\Bar codes.

259
PERPETUUM www.perpetuumsoft.com
software

Picture
Template of a report containing employees’ photos.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Pictures”, set directory to save the
project to.

260
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Pictures Properties… item in the main
menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

261
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

Select “Untyped dataset”, click “OK”

262
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

Click “Add” in order to add table. Set property TableName = Employee.

263
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select Columns property, click button to open Columns Collection Editor. Click “Add” to
add a new column. Add two columns. Set ColumnName properties to “EmployeeName” and
“Picture”. For the Picture column, select DataType property, click button , select
“System.Byte[]” value in the list.

264
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor in order to fill data source.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["EmployeeName"] = "Nancy Davolio";
Image img =
Image.FromFile("C:\\data\\pictures\\NancyDavolio.png");
Byte[] pic = imageToByteArray(img);
row["Picture"] = pic;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["EmployeeName"] = "Andrew Fuller";
img = Image.FromFile("C:\\data\\pictures\\AndrewFuller.png");
pic = imageToByteArray(img);
row["Picture"] = pic;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["EmployeeName"] = "Robert King";
img = Image.FromFile("C:\\data\\pictures\\RobertKing.png");
pic = imageToByteArray(img);
row["Picture"] = pic;
dataTable1.Rows.Add(row);
}
//Function designed to transform image to byte code:
public byte[] imageToByteArray(System.Drawing.Image imageIn)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
imageIn.Save(ms,System.Drawing.Imaging.ImageFormat.Png);
return ms.ToArray();
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

265
PERPETUUM www.perpetuumsoft.com
software

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

Step 8
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

266
PERPETUUM www.perpetuumsoft.com
software

Step 9
Double click on ReportManager to open ReportManager editor.

Go to “Data Sources” tab, click “Add”, set data source name – “Employee”, select data
source value – “dataSet1.Employee”.

267
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

268
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in the property ReportName – “Pictures”. Click “Run Designer” in
order to open template editor - Report Designer.

269
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty template – select File\New in the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

270
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

271
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

272
PERPETUUM www.perpetuumsoft.com
software

Step 14
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand band to the template.

Set data source in the property DataSource = Employee.

On the “Properties” tab, set CanShrink and CanGrow properties to “True”.

Step 15
Press “Detail” button on the Insert tab in the group Container.

273
PERPETUUM www.perpetuumsoft.com
software

Click on the DataBand area to add Detail band inside DataBand.

On the “Properties” tab, set CanShrink and CanGrow properties to “True”.

Step 16
Go to “DataSources” tab.

274
PERPETUUM www.perpetuumsoft.com
software

Drag and drop “EmployeeName” field from the dataBand1 tree o the detail1 band. As a
result TextBox is created. Script loading data from the data source is added to the Value
property.

275
PERPETUUM www.perpetuumsoft.com
software

Step 17
Press “Picture” button on the Insert tab in the group Illustration.

Click on the Detail band area to add Picture element inside Detail. Change size of the bands
and the Picture element. Set SizeMode = Normal on the “Properties” tab.

Click “Bindings” button, set Image property to “dataBand1["Picture"]”.

Step 18
Add one more Detail band, add there Picture element. Double click on the element to open
dialog to select an image. Select picture and click “OK”.

276
PERPETUUM www.perpetuumsoft.com
software

Report template should look as follows:

Step 19
Save template, close Report Designer.

Step 20
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["EmployeeName"] = "Nancy Davolio";
Image img =
Image.FromFile("C:\\data\\pictures\\NancyDavolio.png");
Byte[] pic = imageToByteArray(img);
row["Picture"] = pic;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["EmployeeName"] = "Andrew Fuller";
img = Image.FromFile("C:\\data\\pictures\\AndrewFuller.png");
pic = imageToByteArray(img);
row["Picture"] = pic;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["EmployeeName"] = "Robert King";
img = Image.FromFile("C:\\data\\pictures\\RobertKing.png");
pic = imageToByteArray(img);
row["Picture"] = pic;
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}

277
PERPETUUM www.perpetuumsoft.com
software

private void reportSlot_RenderCompleted(object sender, EventArgs e)


{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 21
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

278
PERPETUUM www.perpetuumsoft.com
software

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 22
Click “Start Debugging” on the Visual Studio toolbar in order to run application.

Click the “Report” button in the opened application window.

Generated report is viewed in the Report Viewer.

279
PERPETUUM www.perpetuumsoft.com
software

To edit report template, close Report Viewer and click “Template” on the application form.

Similar sample in the Samples Center is Report Controls\Basic\Pictures.

280
PERPETUUM www.perpetuumsoft.com
software

Shape
Template of a report containing various shapes.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Shape”, set directory to save the
project to.

281
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Shape Properties… item in the main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

282
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

283
PERPETUUM www.perpetuumsoft.com
software

Step 4
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 5
Double click on ReportManager to open ReportManager editor.

284
PERPETUUM www.perpetuumsoft.com
software

Step 6
Go to “Reports” tab, click “Add” and select “InlineReportSlot”. Set name of the report in the
property ReportName – “Shape”. Click “Run Designer” in order to open template editor -
Report Designer.

285
PERPETUUM www.perpetuumsoft.com
software

Step 7
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

286
PERPETUUM www.perpetuumsoft.com
software

Step 8
Click the “Properties” tab of the tool window in the right part of the designer.

287
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

288
PERPETUUM www.perpetuumsoft.com
software

Step 9
Press the “Detail” button in the Insert tab in the group Container.

Click on the template area to add band to the template. Change the size of the band by
stretching its border.

Step 10
Press the “Shape” button in the Insert tab in the group Illustration.

Click on the Detail band to add the Shape element inside Detail. Change the shape size.
Select the ShapeStyle property, click the button, select “StarShape”.

289
PERPETUUM www.perpetuumsoft.com
software

Click the button to the left from the ShapeStyle property to open additional options. Set
Points = 20, InternalRadius = 0,2.

Select the Fill property, click the button, select “SphericalFill”, set two colors.

290
PERPETUUM www.perpetuumsoft.com
software

Click the button to the left from the Shadow property, set DX = 0,2 cm, DY = 0,1 cm,
Fill = SolidFill.

Click the button to the left from the Line property, set Color = Gray, Style = Dash,
Width = 1.

291
PERPETUUM www.perpetuumsoft.com
software

The report template should look as follows:

Step 11
Save template, close Report Designer.

Step 12
Right click on the application form and select “View Code” in the context menu to view code.

292
PERPETUUM www.perpetuumsoft.com
software

Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 13
Get back to the application form by clicking “Form1.cs [Design]” tab.

Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

293
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 14
Click “Start Debugging” on the Visual Studio toolbar in order to run application.

Click the “Report” button in the opened application window.

294
PERPETUUM www.perpetuumsoft.com
software

Generated report is viewed in the Report Viewer.

To edit report template, close Report Viewer and click “Template” on the application form.

295
PERPETUUM www.perpetuumsoft.com
software

Similar sample in the Samples Center is Report Controls\Basic\Shapes.

296
PERPETUUM www.perpetuumsoft.com
software

Styles
Template of a report containing a list of customers with address, contact person and phone.
Different styles are applied to even and odd rows to make easier to view the report.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Style”, set directory to save the
project to.

297
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Style Properties… item in the main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

298
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

Select “Untyped dataset”, click “OK”

299
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

Click “Add” in order to add table. Set property TableName = Customers.

300
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select Columns property, click button in order to open property editor.

Click “Add” to add a new column. Add four columns. Set ColumnName property to
“CompanyName”, “Address”, “ContactName”, “Phone” correspondingly.

301
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor in order to fill data source.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";

302
PERPETUUM www.perpetuumsoft.com
software

row["Address"] = "Obere Str. 57";


row["ContactName"] = "Maria Anders";
row["Phone"] = "030-0074321";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["Address"] = "Avda. de la Constitución 2222";
row["ContactName"] = "Ana Trujillo";
row["Phone"] = "(5) 555-4729";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["Address"] = "Kirchgasse 6";
row["ContactName"] = "Roland Mendel";
row["Phone"] = "7675-3425";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["Address"] = "Luisenstr. 48";
row["ContactName"] = "Karin Josephs";
row["Phone"] = "0251-031259";
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

303
PERPETUUM www.perpetuumsoft.com
software

Step 8
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 9
Double click on ReportManager to open ReportManager editor.

304
PERPETUUM www.perpetuumsoft.com
software

Go to “Data sources” tab, click “Add”, set data source name – “Customers”, select data
source value – “dataSet1.Customers”.

305
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

306
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in the property ReportName – “List”. Click “Run Designer” in order to
open template editor - Report Designer.

307
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

308
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

309
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

310
PERPETUUM www.perpetuumsoft.com
software

Step 14
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand band to the template.

Set data source in the property DataSource = Customers.

Step 15
Press the “Edit Style” button in the Home tab in the group Styles.

311
PERPETUUM www.perpetuumsoft.com
software

Click the button to add a new style in the Style Sheet Editor. Set Name = EvenLine.

Select the Fill property, click the button to open the fill editor. Select SolidFill; press the
“Color” button. Select the “More Colors…” item in the appeared combo box.

312
PERPETUUM www.perpetuumsoft.com
software

Enter the following values in the Color editor window: Red = 255, Green = 128, Blue = 192.
Press “Ok”.

Set the TextFill property in the same way.

313
PERPETUUM www.perpetuumsoft.com
software

Add one more style. Set Name = OddLine. Set the Fill and TextFill properties different from
the EvenLine.

Step 16
Press the “Detail” button in the Insert tab in the group Container.

Click on the DataBand area to add Detail band inside DataBand.

314
PERPETUUM www.perpetuumsoft.com
software

Select dataBand1 DataBand in the combo box in the “Properties” type.

Click the “Bindings” button in the “Properties” tab, set the StyleName property: StyleName
= dataBand1.LineNumber % 2 == 0 ? "EvenLine" : "OddLine".

Step 17
Go to “DataSources” tab.

315
PERPETUUM www.perpetuumsoft.com
software

Drag and drop fields “CompanyName”, “Address”, “ContactName”, “Phone” from the
dataBand1 tree to the detail1 band. As a result TextBox elements are created. Script
loading data from the data source is added to the Value property.

Change size of the elements and located them in the following way:

316
PERPETUUM www.perpetuumsoft.com
software

Step 18
Save template, close Report Designer.

Step 19
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["Address"] = "Obere Str. 57";
row["ContactName"] = "Maria Anders";
row["Phone"] = "030-0074321";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["Address"] = "Avda. de la Constitución 2222";
row["ContactName"] = "Ana Trujillo";
row["Phone"] = "(5) 555-4729";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["Address"] = "Kirchgasse 6";
row["ContactName"] = "Roland Mendel";
row["Phone"] = "7675-3425";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["Address"] = "Luisenstr. 48";
row["ContactName"] = "Karin Josephs";
row["Phone"] = "0251-031259";
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 20
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

317
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 21
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

318
PERPETUUM www.perpetuumsoft.com
software

Generated report will open with Report Viewer.

In order to edit template, close Report Viewer and press “Template” on the application form.

319
PERPETUUM www.perpetuumsoft.com
software

Similar sample in the Samples Center is Scripting & Binding\Odd/Even lines highlighting.

320
PERPETUUM www.perpetuumsoft.com
software

Sorting
Template of a report containing a list of customers sorted by city and company name.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Sort”, set directory to save the
project to.

321
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Sort Properties… item in the main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

322
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

Select “Untyped dataset”, click “OK”

323
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

Click “Add” in order to add table. Set property TableName = Customers.

324
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select Columns property, click button in order to open property editor.

Click “Add” to add a new column. Add three columns. Set ColumnName property to
“CompanyName”, “City”, and “Address”.

325
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor in order to fill data source.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";

326
PERPETUUM www.perpetuumsoft.com
software

row["City"] = "London";
row["Address"] = "Obere Str. 57";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["City"] = "Paris";
row["Address"] = "Avda. de la Constitución 2222";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["City"] = "London";
row["Address"] = "Kirchgasse 6";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["City"] = "New York";
row["Address"] = "Luisenstr. 48";
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

327
PERPETUUM www.perpetuumsoft.com
software

Step 8
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 9
Double click on ReportManager to open ReportManager editor.

328
PERPETUUM www.perpetuumsoft.com
software

Go to “Data sources” tab, click “Add”, set data source name – “Customers”, select data
source value – “dataSet1.Customers”.

329
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

330
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in the property ReportName – “Sort”. Click “Run Designer” in order
to open template editor - Report Designer.

331
PERPETUUM www.perpetuumsoft.com
software

Step12
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

332
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

333
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

334
PERPETUUM www.perpetuumsoft.com
software

Step 14
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand band to the template.

Set data source in the property DataSource = Customers.

Select Sort property, click button to open property collection editor.

335
PERPETUUM www.perpetuumsoft.com
software

Click button to add new sorting condition. Set Expression property to


“GetData("Customers.City")”, and property Order = Ascending.

Add one more condition, set Expression = GetData("Customers.CompanyName"), Order =


Ascending.

336
PERPETUUM www.perpetuumsoft.com
software

Step 15
Press “Detail” button on the Insert tab in the group Container.

Click on the DataBand area to add Detail band inside DataBand.

Step 16
Go to “Data Source” tab.

337
PERPETUUM www.perpetuumsoft.com
software

Drag and drop “CompanyName”, “City”, “Address” fields from the dataBand1 tree to the
detail1 band. As a result TextBoxes are created. Value property is automatically filled with
script loading data from the data source.

Change size of the elements and locate them in the way shown in the picture below.

338
PERPETUUM www.perpetuumsoft.com
software

Step 17
Save template, close Report Designer.

Step 18
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["City"] = "London";
row["Address"] = "Obere Str. 57";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["City"] = "Paris";
row["Address"] = "Avda. de la Constitución 2222";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["City"] = "London";
row["Address"] = "Kirchgasse 6";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["City"] = "New York";
row["Address"] = "Luisenstr. 48";
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 19
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

339
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 20
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

340
PERPETUUM www.perpetuumsoft.com
software

Generated report will open with Report Viewer.

In order to edit template, close Report Viewer and press “Template” on the application form.

341
PERPETUUM www.perpetuumsoft.com
software

Filtering
Template of a report containing odd numbers from the set of integers.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Filter”, set directory to save the
project to.

342
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Filter Properties… item in the main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

343
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

Select “Untyped dataset”, click “OK”

344
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

Click “Add” in order to add table. Set property TableName = Number.

345
PERPETUUM www.perpetuumsoft.com
software

Select Columns property, click button in order to open property editor.

Step 5
Click “Add” to add a new column. Set ColumnName property to “Value”.

346
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor in order to fill data source.

public Form1()
{
InitializeComponent();
DataRow row;
for (int i = 0; i < 50; i++)
{
row = dataTable1.NewRow();
row["Value"] = i;
dataTable1.Rows.Add(row);
}
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

347
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 8
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 9
Double click on ReportManager to open ReportManager editor.

348
PERPETUUM www.perpetuumsoft.com
software

Go to “Data sources” tab, click “Add”, and set data source name – “Number”, select data
source value – “dataSet1.Number”.

349
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

350
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in the property ReportName – “Filter”. Click “Run Designer” in order
to open template editor - Report Designer.

351
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

352
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

353
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

354
PERPETUUM www.perpetuumsoft.com
software

Step 14
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand band to the template.

Set data source in the property DataSource = Number.

Select FilterExpression property, click button to open Script Editor. Enter filtering
condition to display only odd numbers: Convert.ToInt32 (GetData("Number.Value")) % 2 !=
0”

Step 15
Press “Detail” button on the Insert tab in the group Container.

355
PERPETUUM www.perpetuumsoft.com
software

Click on the DataBand area to add Detail band inside DataBand.

Step 16
Go to “DataSources” tab.

356
PERPETUUM www.perpetuumsoft.com
software

Drag and drop “Value” field from the dataBand1 tree to the detail1 band. As a result
TextBoxes are created. Value property is automatically filled with script loading data from
the data source.

Step 17
Save template, close Report Designer.

Step 18
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row;
for (int i = 0; i < 50; i++)
{
row = dataTable1.NewRow();
row["Value"] = i;
dataTable1.Rows.Add(row);
}
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 19
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

357
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 20
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

Generated report will open with Report Viewer.

358
PERPETUUM www.perpetuumsoft.com
software

In order to edit template, close Report Viewer and press “Template” on the application form.

359
PERPETUUM www.perpetuumsoft.com
software

Grouping
Template of a report containing information on customers grouped by the first letter of the
company name.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Group”, set directory to save the
project to.

360
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Group Properties… item in the main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

Press the “Yes” button in the opened window.

361
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

Select “Untyped dataset”, click “OK”

362
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

Click “Add” in order to add table. Set property TableName = Customers.

363
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select Columns property, click button in order to open property editor.

Click “Add” to add a new column. Add four columns. Set ColumnName property to
“CompanyName”, “Address”, “ContactName”, “Phone”.

364
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor in order to fill data source.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";

365
PERPETUUM www.perpetuumsoft.com
software

row["Address"] = "Obere Str. 57";


row["ContactName"] = "Maria Anders";
row["Phone"] = "030-0074321";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["Address"] = "Avda. de la Constitución 2222";
row["ContactName"] = "Ana Trujillo";
row["Phone"] = "(5) 555-4729";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["Address"] = "Kirchgasse 6";
row["ContactName"] = "Roland Mendel";
row["Phone"] = "7675-3425";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["Address"] = "Luisenstr. 48";
row["ContactName"] = "Karin Josephs";
row["Phone"] = "0251-031259";
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

366
PERPETUUM www.perpetuumsoft.com
software

Step 8
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 9
Double click on ReportManager to open ReportManager editor.

367
PERPETUUM www.perpetuumsoft.com
software

Go to “Data sources” tab, click “Add”, set data source name – “Customers”, select data
source value – “dataSet1.Customers”.

368
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

369
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in the property ReportName – “Group”. Click “Run Designer” in order
to open template editor - Report Designer.

370
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

371
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

372
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

373
PERPETUUM www.perpetuumsoft.com
software

Step 14
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand band to the template.

Set data source in the property DataSource = Customers.

Step 15
Press “GroupBand” button on the Insert tab in the group Container.

374
PERPETUUM www.perpetuumsoft.com
software

Click on the DataBand area to add GroupBand inside DataBand.

Select GroupExpression property on the “Properties” tab. Click button to open property
editor – Script Editor.

Enter code to group records by the first letter in the company name:
“GetData("Customers.CompanyName").ToString().Substring(0,1)”.

Template should look as follows on this stage:

Step 16
To display header for every group, create Header band – press “Header” button on the
Insert tab in the group Container.

375
PERPETUUM www.perpetuumsoft.com
software

Click on the GroupBand area to add Header band inside GroupBand.

Step 17
Press button “TextBox” on the Insert tab in the group Text.

Click on the Header band to add TextBox element to Header.

Set Value property to “Group”.

Step 18
Press “Detail” button on the Insert tab in the group Container.

Click on the GroupBand area to add Detail band inside GroupBand.

Step 19
Go to “DataSources” tab.

376
PERPETUUM www.perpetuumsoft.com
software

Drag and drop “CompanyName”, “Address”, “ContactName”, “Phone” fields from the
dataBand1 tree to the detail1 band. As a result TextBoxes are created. Value property is
automatically filled with script loading data from the data source. Change size of the
elements and locate them in the way shown in the picture below.

377
PERPETUUM www.perpetuumsoft.com
software

In order to view template structure, go to “DocumentTree” tab.

378
PERPETUUM www.perpetuumsoft.com
software

Step 20
Save template, close Report Designer.

Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["Address"] = "Obere Str. 57";
row["ContactName"] = "Maria Anders";
row["Phone"] = "030-0074321";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["Address"] = "Avda. de la Constitución 2222";
row["ContactName"] = "Ana Trujillo";
row["Phone"] = "(5) 555-4729";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["Address"] = "Kirchgasse 6";
row["ContactName"] = "Roland Mendel";
row["Phone"] = "7675-3425";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["Address"] = "Luisenstr. 48";
row["ContactName"] = "Karin Josephs";
row["Phone"] = "0251-031259";
row["Phone"] = "7675-3425";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["Address"] = "Luisenstr. 48";
row["ContactName"] = "Karin Josephs";
row["Phone"] = "0251-031259";
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 21
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

379
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 22
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

380
PERPETUUM www.perpetuumsoft.com
software

Generated report is viewed in the Report Viewer.

In order to edit template, close Report Viewer and press “Template” on the application form.

381
PERPETUUM www.perpetuumsoft.com
software

Similar sample in the Samples Center is Reports\Grouping\Groups.

382
PERPETUUM www.perpetuumsoft.com
software

Hyperlinks and Bookmarks


Template of a report containing a list of customers grouped by the first letter. Report
contains a table of contents with hyperlinks for quick navigation and links to customer
websites and emails of contact persons.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Bookmarks_Hyperlinks”, set


directory to save the project to.

383
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Bookmarks_Hiberlinks Properties… item in
the main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

384
PERPETUUM www.perpetuumsoft.com
software

Press the “Yes” button in the opened window.

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

385
PERPETUUM www.perpetuumsoft.com
software

Select “Untyped dataset”, click “OK”

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

386
PERPETUUM www.perpetuumsoft.com
software

Click “Add” in order to add table. Set property TableName = Customers.

Step 5
Select Columns property, click button in order to open property editor.

387
PERPETUUM www.perpetuumsoft.com
software

Click “Add” to add a new column. Add three columns. Set ColumnName property to
“CompanyName”, “City”, and “ContactName”.

Step 6
Right click on the form and select “View Code” in the context menu to view code.

388
PERPETUUM www.perpetuumsoft.com
software

Add the following code to the class constructor in order to fill data source.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["City"] = "Boston";
row["ContactName"] = "Maria Anders";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["City"] = "London";
row["ContactName"] = "Ana Trujillo";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["City"] = "Paris";
row["ContactName"] = "Roland Mendel";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["City"] = "Moscow";
row["ContactName"] = "Karin Josephs";
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

389
PERPETUUM www.perpetuumsoft.com
software

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

Step 8
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 9
Double click on ReportManager to open ReportManager editor.

390
PERPETUUM www.perpetuumsoft.com
software

Go to “Data sources” tab, click “Add”, set data source name – “Customers”, select data
source value – “dataSet1.Customers”.

391
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

392
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in the property ReportName – “Bookmarks_Hyperlinks”.

Click “Run Designer” in order to open template editor - Report Designer.

393
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

394
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

395
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

396
PERPETUUM www.perpetuumsoft.com
software

Step 14
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand band to the template.

Set data source in the property DataSource = Customers.

Step 15
Press “GroupBand” button on the Insert tab in the group Container.

397
PERPETUUM www.perpetuumsoft.com
software

Click on the DataBand area to add GroupBand inside DataBand.

Set property GroupExpression =


GetData("Customers.CompanyName").ToString().Substring(0,1).

Step 16
Press “Header” button on the Insert tab in the group Container.

Click on the GroupBand area to add Header band inside GroupBand.

Step 17
Press button “TextBox” on the Insert tab in the group Text.

Click on the Header area to add TextBox element inside Header.

Click “Bindings” button on the “Properties” tab. Set properties Value = "Go to
"+dataBand1["CompanyName"].ToString().Substring(0,1), Bookmark =
"Letter_"+dataBand1["CompanyName"].ToString().Substring(0,1), Hyperlink = "#" +
dataBand1["CompanyName"].ToString().Substring(0,1).

398
PERPETUUM www.perpetuumsoft.com
software

The first template page looks as follows:

Step 18
Press button “NewPage” on the Insert tab in the group Page to add a new template.

Step 19
Add DataBand to the second page. Set property DataSource = Customers.

Step 20
Add GroupBand to the dataBand2 band. Set property GroupExpression =
dataBand2["CompanyName"].ToString().Substring(0,1).

399
PERPETUUM www.perpetuumsoft.com
software

Step 21
Add Header band to the groupBand2 band. Add TextBox. Click “Bindings” button, set
properties Value = dataBand2["CompanyName"].ToString().Substring(0,1), Bookmark =
"#" + dataBand2["CompanyName"].ToString().Substring(0,1).

Step 22
Add one more TextBox element to the header2 band. Set properties Text = Back, Hyperlink
= Back.

Step 23
Press “Detail” button on the Insert tab in the group Container.

Click on the groupBand2 area to add Detail band inside groupBand2.

400
PERPETUUM www.perpetuumsoft.com
software

Step 24
Go to “DataSources” tab.

Drag and drop “CompanyName” and “ContactName” fields from the dataBand1 to the
detail1 band. As a result TextBoxes are created. Value property is automatically filled with
script loading data from the data source.

Step 25
Select the first TextBox element. Click “Bindings” button, set property Hyperlink =
"http://www." + dataBand2["CompanyName"].ToString() + ".com". Select the second

401
PERPETUUM www.perpetuumsoft.com
software

TextBox element, set property Hyperlink = "mailto:" +


dataBand2["ContactName"].ToString() + "@" + dataBand2["CompanyName"].ToString() +
".com".

The second template page should look as follows:

Step 26
Save template, close Report Designer.

Step 27
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["City"] = "Boston";
row["ContactName"] = "Maria Anders";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["City"] = "London";
row["ContactName"] = "Ana Trujillo";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["City"] = "Paris";
row["ContactName"] = "Roland Mendel";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["City"] = "Moscow";
row["ContactName"] = "Karin Josephs";
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 28
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

402
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 29
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

403
PERPETUUM www.perpetuumsoft.com
software

Generated report is viewed in the Report Viewer.

The first page:

You can navigate through the report using hyperlinks – click on the hyperlink to
open the corresponding group.

The second page:

404
PERPETUUM www.perpetuumsoft.com
software

Click on the company name and you will open company webpage in the browser. Click on
the contact name and mail client will open to send email to this person.

To edit report template, close Report Viewer and click “Template” on the application form.

Similar sample in the Samples Center is Reports\Special features\Hyperlinks & Bookmarks.

405
PERPETUUM www.perpetuumsoft.com
software

Totals
Template of a report containing a list of products, price of every product and total order
price.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Aggregate”, set directory to save
the project to.

406
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Aggregate Properties… item in the main
menu.

Select item Target framework\.NET Framework4 from the tab Application.

In the opened window press the “Yes” button.

407
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

Select “Untyped dataset”, click “OK”

408
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

Click “Add” in order to add table. Set property TableName = Order.

409
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select Columns property, click button in order to open property editor.

Click “Add” to add a new column. Add two columns. Set ColumnName property to “Product”,
“Price” correspondingly.

410
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor in order to fill data source.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["Product"] = "Chai";

411
PERPETUUM www.perpetuumsoft.com
software

row["Price"]="14.40";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["Product"] = "Chang";
row["Price"] = "15.20";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["Product"] = "Ipoh Coffee";
row["Price"] = "46.00";
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

Step 8
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

412
PERPETUUM www.perpetuumsoft.com
software

Step 9
Double click on ReportManager to open ReportManager editor.

Go to “Data sources” tab, click “Add”, set data source name – “Order”, select data source
value – “dataSet1.Order”.

413
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

414
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in the property ReportName – “Aggregate”.

Click “Run Designer” in order to open template editor - Report Designer.

415
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

416
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

417
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

418
PERPETUUM www.perpetuumsoft.com
software

Step 14
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand band to the template.

Set data source in the property DataSource = Order.

Step 15
Select Totals property, click button to open editor of the Total property collection.

419
PERPETUUM www.perpetuumsoft.com
software

In the Collection editor, click button to add aggregation function. Set the following
properties: AggregateFunction = Sum, Expression = dataBand1["Price"], Name = Sum.

Step 16
Press “Detail” button on the Insert tab in the group Container.

Click on the DataBand area to add Detail band inside DataBand.

Step 17
Go to “DataSources” tab.

420
PERPETUUM www.perpetuumsoft.com
software

Drag and drop “Product” and “Price” fields from the dataBand1 tree to the detail1 band. As
a result TextBoxes are created. Value property is automatically filled with script loading data
from the data source.

Change size of the elements and locate them in the way shown in the picture below.

421
PERPETUUM www.perpetuumsoft.com
software

Step 18
To display footer containing summarized value of the Price field, create Footer band – press
“Footer” button on the Insert tab in the group Container.

Click on the DataBand area to add Footer inside DataBand.

Step 19
Press button “TextBox” on the Insert tab in the group Text.

Click on the Footer band area to add TextBox element inside Footer.

Set Value property to “GetTotal("Sum")”.

Report Template:

Step 20
Save template, close Report Designer.

Step 21
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["Product"] = "Chai";
row["Price"]="14.40";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["Product"] = "Chang";
row["Price"] = "15.20";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();

422
PERPETUUM www.perpetuumsoft.com
software

row["Product"] = "Ipoh Coffee";


row["Price"] = "46.00";
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 22
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

423
PERPETUUM www.perpetuumsoft.com
software

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 23
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

Generated report is viewed in the Report Viewer.

To edit report template, close Report Viewer and click “Template” on the application form.

424
PERPETUUM www.perpetuumsoft.com
software

Similar sample in the Samples Center is Reports\Grouping\Group aggregates.

425
PERPETUUM www.perpetuumsoft.com
software

Nested Group
Template of a report containing a list of customers grouped by countries and cities.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Group”, set directory to save the
project to.

426
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Group Properties… item in the main menu.

Select item Target framework\.NET Framework4 from the tab Application.

In the opened window press the “Yes” button.

427
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

Select “Untyped dataset”, click “OK”

428
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

Click “Add” in order to add table. Set property TableName = Customers.

429
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select Columns property, click button in order to open property editor.

Click “Add” to add a new column. Add three columns. Set ColumnName property to
“Country”, “City”, “CompanyName” correspondingly.

430
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor in order to fill data source.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";

431
PERPETUUM www.perpetuumsoft.com
software

row["City"] = "London";
row["Country"] = "England";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["City"] = "Paris";
row["Country"] = "France";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["City"] = "Manchester";
row["Country"] = "England";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Prod House";
row["City"] = "Manchester";
row["Country"] = "England";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["City"] = "New York";
row["Country"] = "USA";
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

432
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 8
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 9
Double click on ReportManager to open ReportManager editor.

433
PERPETUUM www.perpetuumsoft.com
software

Go to “Data sources” tab, click “Add”, set data source name – “Customers”, select data
source value – “dataSet1.Customers”.

434
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

435
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in the property ReportName – “Group”.

Click “Run Designer” in order to open template editor - Report Designer.

436
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

437
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

438
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

439
PERPETUUM www.perpetuumsoft.com
software

Step 14
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand band to the template.

Set data source in the property DataSource = Customers.

Step 15
Press “GroupBand” button on the Insert tab in the group Container.

440
PERPETUUM www.perpetuumsoft.com
software

Click on the DataBand area to add GroupBand inside DataBand.

To group list by country set GroupExpression property on the “Properties” tab to


“GetData("Customers.Country")”.

Report template on this stage should look as follows:

Step 16
To display header of every group create Header band - press “Header” button on the Insert
tab in the group Container.

Click on the GroupBand area to add Header band inside GroupBand.

Step 17
Press button “TextBox” on the Insert tab in the group Text.

441
PERPETUUM www.perpetuumsoft.com
software

Click on the Header area to add TextBox element inside the Header.

Set Value property to “Group”.

Step 18
Press “GroupBand” button on the Insert tab in the group Container.

Click on the GroupBand area to add the second GroupBand inside it.

To group list by city set GroupExpression property on the “Properties” tab to


“GetData("Customers.City")”.

Step 19
To display group header add Header band to the groupBand2, add TextBox, set property
Value = Group.

Step 20
Press “Detail” button on the Insert tab in the group Container.

442
PERPETUUM www.perpetuumsoft.com
software

Click on the groupBand2 area to add Detail band inside groupBand2.

Step 21
Go to “DataSources” tab.

443
PERPETUUM www.perpetuumsoft.com
software

Drag and drop “CompanyName” field from the dataBand1 tree to the detail1 band. As a
result TextBox is created. Value property is automatically filled with script loading data from
the data source.

Change size of the elements and locate them in the way shown in the picture below.

444
PERPETUUM www.perpetuumsoft.com
software

In order to view template structure, go to “DocumentTree” tab.

445
PERPETUUM www.perpetuumsoft.com
software

Step 22
Save template, close Report Designer.

Step 23
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();

446
PERPETUUM www.perpetuumsoft.com
software

row["CompanyName"] = "Alfreds Futterkiste";


row["City"] = "London";
row["Country"] = "England";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["City"] = "Paris";
row["Country"] = "France";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["City"] = "Manchester";
row["Country"] = "England";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Prod House";
row["City"] = "Manchester";
row["Country"] = "England";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["City"] = "New York";
row["Country"] = "USA";
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 24
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

447
PERPETUUM www.perpetuumsoft.com
software

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 25
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

Generated report is viewed in the Report Viewer.

448
PERPETUUM www.perpetuumsoft.com
software

To edit report template, close Report Viewer and click “Template” on the application form.

Similar sample in the Samples Center is Reports\Grouping\Nested Groups.

449
PERPETUUM www.perpetuumsoft.com
software

Joint Use of Grouping, Sorting, Filtering and Totals


Template of a report containing list of customers grouped by city; for every customer – a
list of orders sorted by date. The report will contain orders made after January 1, 2010.
Aggregation function will calculate total orders price for every employee.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Report”, set directory to save the
project to.

450
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Report Properties… item in the main
menu.

Select item Target framework\.NET Framework4 from the tab Application.

451
PERPETUUM www.perpetuumsoft.com
software

In the opened window press the “Yes” button.

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

452
PERPETUUM www.perpetuumsoft.com
software

Select “Untyped dataset”, click “OK”

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

453
PERPETUUM www.perpetuumsoft.com
software

Click “Add” in order to add table. Set property TableName = Customers.

Step 5
Select Columns property, click button in order to open property editor.

454
PERPETUUM www.perpetuumsoft.com
software

Click “Add” to add a new column. Add three columns. Set ColumnName property to
“CompanyName”, “City”, “CustNo” correspondingly. For the “CustNo” column, set the
following properties DataType = System.Int32, AllowDBNull = False.

455
PERPETUUM www.perpetuumsoft.com
software

Step 6
In the Tables Collection Editor, click “Add” in order to add one more table. Set TableName
to “Orders”.

Open Columns property editor. Add four columns, set ColumnName property to “OrderID”,
“OrderDate”, “and OrderSum ”, “ CustNo”. For the “CustNo” column, set the following
properties DataType = System.Int32, AllowDBNull = False. For the “OrderDate” column, set
property DataType = System.DateTime.

456
PERPETUUM www.perpetuumsoft.com
software

Step 7
Select the Relations property in the property grid. Click the button in order to open the
property editor.

Press the “Add” button in order to add the binding between the tables.

457
PERPETUUM www.perpetuumsoft.com
software

Set the Name = “CustomersOrders” properties in the Relation opened window. Select the
Key Columns and Foreign Key Columns = “CustNo” in Columns. Click “Ok”.

458
PERPETUUM www.perpetuumsoft.com
software

Step 8
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor in order to fill data source.

459
PERPETUUM www.perpetuumsoft.com
software

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CustNo"] = 1;
row["CompanyName"] = "Bon App'";
row["City"] = "Paris";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CustNo"] = 2;
row["CompanyName"] = "Chop-suey Chinese";
row["City"] = "London";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CustNo"] = 3;
row["CompanyName"] = "Maison Dewey";
row["City"] = "Paris";
dataTable1.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 1;
row["OrderID"] = "00001";
row["OrderDate"] = "2010,03,21";
row["OrderSum"] = "50.00";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 1;
row["OrderID"] = "00002";
row["OrderDate"] = "2010,02,15";
row["OrderSum"] = "14.50";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00010";
row["OrderDate"] = "2010,04,03";
row["OrderSum"] = "134.00";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00011";
row["OrderDate"] = "2010,01,15";
row["OrderSum"] = "45.45";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00013";
row["OrderDate"] = "2010,02,01";
row["OrderSum"] = "500.00";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00101";
row["OrderDate"] = "2009,12,30";
row["OrderSum"] = "6.03";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 3;
row["OrderID"] = "00666";
row["OrderDate"] = "2010,06,06";
row["OrderSum"] = "66.66";
dataTable2.Rows.Add(row);
}

460
PERPETUUM www.perpetuumsoft.com
software

Step 9
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

Step 10
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

461
PERPETUUM www.perpetuumsoft.com
software

Step 11
Double click on ReportManager to open ReportManager editor.

Go to “Data sources” tab, click “Add”, set data source name – “CustomersOrders”, select
data source value – “dataSet1”.

462
PERPETUUM www.perpetuumsoft.com
software

Step 12
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

463
PERPETUUM www.perpetuumsoft.com
software

Step 13
Set name of the report in the property ReportName – “Report”.

Click “Run Designer” in order to open template editor - Report Designer.

464
PERPETUUM www.perpetuumsoft.com
software

Step 14
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

465
PERPETUUM www.perpetuumsoft.com
software

Step 15
Click the “Properties” tab of the tool window in the right part of the designer.

466
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

467
PERPETUUM www.perpetuumsoft.com
software

Step 16
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand band to the template.

Set data source in the property DataSource = CustomersOrders.Customers.

Step 17
Press “GroupBand” button on the Insert tab in the group Container.

Click on the DataBand area to add GroupBand inside DataBand.

Select GroupExpression property on the “Properties” tab. Click button to open property
editor – Script Editor.

468
PERPETUUM www.perpetuumsoft.com
software

Set condition to group records by city “GetData("CustomersOrders.Customers.City")”.

Step 18
To display header of every page create Header band – press “Header” button on the Insert
tab in the group Container.

Click on the GroupBand area to add Header band inside GroupBand.

Step 19
Press button “TextBox” on the Insert tab in the group Text.

469
PERPETUUM www.perpetuumsoft.com
software

Click on the Header area to add TextBox element inside Header.

Set Value property to “Group”.

Step 20
Press “Detail” button on the Insert tab in the group Container.

Click on the GroupBand area to add Detail band inside GroupBand.

Step 21
Go to “DataSources” tab.

470
PERPETUUM www.perpetuumsoft.com
software

Drag and drop “CompanyName” field from the dataBand1 tree to the detail1 band. As a
result TextBoxes are created. Value property is automatically filled with script loading data
from the data source.

471
PERPETUUM www.perpetuumsoft.com
software

Step 22
Add DataBand inside GroupBand. Set property DataSource =
CustomersOrders.Customers.CustomresOrders

Step 23
Select dataBand2, select Sort property, click button to open Collection Editor – Sort
property editor.

In the Collections Editor, click button. Set the following properties: Expression =
dataBand2["OrderDate"], Order = Descending to soft orders by date in descending order.

472
PERPETUUM www.perpetuumsoft.com
software

Step 24
Select dataBand2, select Totals property, click to open Collections Editor – Totals
property editor.

In the Collections Editor click button. Set the following properties: AggregateFunction =
Sum, Expression = dataBand2["OrderSum"], Name = Sum.

473
PERPETUUM www.perpetuumsoft.com
software

Step 25
Select dataBand2, select FilterExpression property, click button to open Script Editor –
FilterExpression property editor.

Enter the following code:

“((DateTime)dataBand2["OrderDate"]) > new DateTime(2010,01,01)”

Step 26
Add Detail band to the dataBand2.

Step 27
Go to DataSources tab and drag and drop the following fields: “OrderID”, “OrderDate”, and
“OrderSum” from the dataBand2 tree to the detail2 band.

474
PERPETUUM www.perpetuumsoft.com
software

Step 28
Select TextBox element with the Value = dataBand2["OrderDate"]. Select TextFormat
property, click button to open form of selecting text format.

475
PERPETUUM www.perpetuumsoft.com
software

Select “Date” in the “Formats” list; item “dd/MM/yy” in the “Properties” list.

476
PERPETUUM www.perpetuumsoft.com
software

Step 29
In the same way, the select TextBox element with the Value = dataBand2["OrderSum"].
Select the TextFormat property, click the button to open form of the selected text
format.

Select “Currency” in the “Formats” list. Uncheck “Use local settings” in the “Properties” tab.
Set the other properties as you need.

477
PERPETUUM www.perpetuumsoft.com
software

Step 30
To display footer containing summarized value of the OrderSum field create Footer band –
press “Footer” button on the Insert tab in the group Container.

Click on the dataBand2 area to add Footer band inside dataBand2.

Step 31
Add the TextBox element inside Footer band, set the Value = GetTotal("Sum") property. Set
the element’s properties as you did it in step 29.

Step 32
Save template, close Report Designer.

Step 33
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CustNo"] = 1;
row["CompanyName"] = "Bon App'";
row["City"] = "Paris";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CustNo"] = 2;
row["CompanyName"] = "Chop-suey Chinese";
row["City"] = "London";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CustNo"] = 3;
row["CompanyName"] = "Maison Dewey";

478
PERPETUUM www.perpetuumsoft.com
software

row["City"] = "Paris";
dataTable1.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 1;
row["OrderID"] = "00001";
row["OrderDate"] = "2010,03,21";
row["OrderSum"] = "50.00";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 1;
row["OrderID"] = "00002";
row["OrderDate"] = "2010,02,15";
row["OrderSum"] = "14.50";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00010";
row["OrderDate"] = "2010,04,03";
row["OrderSum"] = "134.00";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00011";
row["OrderDate"] = "2010,01,15";
row["OrderSum"] = "45.45";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00013";
row["OrderDate"] = "2010,02,01";
row["OrderSum"] = "500.00";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 2;
row["OrderID"] = "00101";
row["OrderDate"] = "2009,12,30";
row["OrderSum"] = "6.03";
dataTable2.Rows.Add(row);
row = dataTable2.NewRow();
row["CustNo"] = 3;
row["OrderID"] = "00666";
row["OrderDate"] = "2010,06,06";
row["OrderSum"] = "66.66";
dataTable2.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 34
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

479
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 35
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

480
PERPETUUM www.perpetuumsoft.com
software

Generated report is viewed in the Report Viewer.

To edit report template, close Report Viewer and click “Template” on the application form.

481
PERPETUUM www.perpetuumsoft.com
software

482
PERPETUUM www.perpetuumsoft.com
software

Managing Size
Template of a report containing information on employees – name, phone, note. Size of the
TextBox containing a note is changed depending on data.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Size_Position”, set directory to save
the project to.

483
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Size_Position Properties… item in the main
menu.

Select item Target framework\.NET Framework4 from the tab Application.

In the opened window press the “Yes” button.

484
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

Select “Untyped dataset”, click “OK”

485
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

Click “Add” in order to add table. Set property TableName = Employee.

486
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select Columns property, click button in order to open property editor.

Click “Add” to add a new column. Add three columns. Set ColumnName property to
“EmployeeName”, “HomePhone”, and “Note”.

487
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor in order to fill data source.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["EmployeeName"] = "Nancy Davolio";
row["HomePhone"] = "(206)555-9857";
row["Note"] = "Education includes a BA in psychology from
Colorado State University in 1970. She also completed The Art of the Cold
Call. Nancy is a member of Toastmasters International.";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["EmployeeName"] = "Andrew Fuller";
row["HomePhone"] = "(206) 555-9482";
row["Note"] = "Andrew received his BTS commercial in 1974 and a
Ph.D. in international marketing from the University of Dallas in 1981. He
is fluent in French and Italian and reads German. He joined the company as a
sales representative, was promoted to sales manager in January 1992 and to
vice president of sales in March 1993. Andrew is a member of the Sales
Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim
Importers Association.";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["EmployeeName"] = "Anne Dodsworth";
row["HomePhone"] = "(71) 555-4444";
row["Note"] = "Anne has a BA degree in English from St. Lawrence
College. She is fluent in French and German.";
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

488
PERPETUUM www.perpetuumsoft.com
software

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

Step 8
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

489
PERPETUUM www.perpetuumsoft.com
software

Step 9
Double click on ReportManager to open ReportManager editor.

Go to “Data sources” tab, click “Add”, set data source name – “Employee”, select data
source value – “dataSet1.Employee”.

490
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

491
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in the property ReportName – “Size_Position”.

Click “Run Designer” in order to open template editor - Report Designer.

492
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

493
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

494
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

495
PERPETUUM www.perpetuumsoft.com
software

Set property GridStep = 0,2 cm.

Step 14
Press “Detail” button on the Insert tab in the group Container.

Click on the template area to add a band.

Step 15
Press button “TextBox” on the Insert tab in the group Text.

Click on the Detail band area to add TextBox element inside Detail.

Double click on the TextBox area to open Text editor. Enter the following text: “information
about employees”.

Change size of the TextBox element by dragging its corner. Set its size to “5,8; 0,6 cm”.
Changing of the size is visible on the property grid.

496
PERPETUUM www.perpetuumsoft.com
software

Select Detail band. Set Size property to “21; 0,6 cm”.

Step 16
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand to the template.

Set data source in the property DataSource = Employee.

Set CanGrow and CanShrink properties to “True”.

497
PERPETUUM www.perpetuumsoft.com
software

Step 17
Press “Detail” button on the Insert tab in the group Container.

Click on the DataBand area to add Detail band inside DataBand.

Set CanGrow and CanShrink properties of the Detail band to “True”.

Step 18
Go to “DataSources” tab.

498
PERPETUUM www.perpetuumsoft.com
software

Drag and drop “EmployeeName”, “HomePhone”, “Note” fields from the dataBand1 tree to
the detail1 band. As a result TextBoxes are created. Value property is automatically filled
with script loading data from the data source.

Change size and position of the DataBand and Detail bands.

Select all TextBox elements, click “Left Alignment” button on the Home tab in the group
Alignment. Set Size property of TextBoxes to “8; 0,6 cm”.

499
PERPETUUM www.perpetuumsoft.com
software

Step 19
Select TextBox with dataBand1["Note"]. Set the CanShrink and CanGrow properties to
“True” in property grid.

Step 20
Add one more TextBox to the detail2 band. Change its size and position so that the other
three TextBox elements were inside the added element. Select the Border property, click
the button to open Border Editor. Set border for the element.

Select the Size property in Binding ToolBar and set the value to “new
Vector(textBox5.Size.X, Unit.Convert(1.2,Unit.Centimeter, Unit.InternalUnit) +
(double)textBox4.RenderHeight)”.

500
PERPETUUM www.perpetuumsoft.com
software

Step 21
Save template, close Report Designer.

Step 22
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();

501
PERPETUUM www.perpetuumsoft.com
software

row["EmployeeName"] = "Nancy Davolio";


row["HomePhone"] = "(206)555-9857";
row["Note"] = "Education includes a BA in psychology from
Colorado State University in 1970. She also completed The Art of the Cold
Call. Nancy is a member of Toastmasters International.";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["EmployeeName"] = "Andrew Fuller";
row["HomePhone"] = "(206) 555-9482";
row["Note"] = "Andrew received his BTS commercial in 1974 and a
Ph.D. in international marketing from the University of Dallas in 1981. He
is fluent in French and Italian and reads German. He joined the company as a
sales representative, was promoted to sales manager in January 1992 and to
vice president of sales in March 1993. Andrew is a member of the Sales
Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim
Importers Association.";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["EmployeeName"] = "Anne Dodsworth";
row["HomePhone"] = "(71) 555-4444";
row["Note"] = "Anne has a BA degree in English from St. Lawrence
College. She is fluent in French and German.";
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 23
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

502
PERPETUUM www.perpetuumsoft.com
software

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 24
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

Generated report is viewed in the Report Viewer.

503
PERPETUUM www.perpetuumsoft.com
software

To edit report template, close Report Viewer and click “Template” on the application form.

504
PERPETUUM www.perpetuumsoft.com
software

Report without Bands


Template of a card storing information on the customer. The card contains data on company
name, address, phone, and name of contact person.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “WithoutBands”, set directory to save
the project to.

505
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\WithoutBands Properties… item in the
main menu.

Select item Target framework\.NET Framework4 from the tab Application.

In the opened window press the “Yes” button.

506
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

Select “Untyped dataset”, click “OK”

507
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

Click “Add” in order to add table. Set property TableName = Customers.

508
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select Columns property, click button in order to open property editor.

Click “Add” to add a new column. Add four columns. Set ColumnName property to
“CompanyName”, “Address”, “ContactName”, “Phone” correspondingly.

509
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor in order to fill data source.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";

510
PERPETUUM www.perpetuumsoft.com
software

row["Address"] = "Obere Str. 57";


row["ContactName"] = "Maria Anders";
row["Phone"] = "030-0074321";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["Address"] = "Avda. de la Constitución 2222";
row["ContactName"] = "Ana Trujillo";
row["Phone"] = "(5) 555-4729";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["Address"] = "Kirchgasse 6";
row["ContactName"] = "Roland Mendel";
row["Phone"] = "7675-3425";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["Address"] = "Luisenstr. 48";
row["ContactName"] = "Karin Josephs";
row["Phone"] = "0251-031259";
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click on the “DataGridView” on the Toolbox and place this component onto the form.

511
PERPETUUM www.perpetuumsoft.com
software

Step 8
Select DataGridView element. On the property grid, select DataSource property, click button
, select “dataSet1” as a data source.

Select “Customers” table in the DataMember property.

Change size of the form and DataGridView element so that all the columns are visible on the
form.

512
PERPETUUM www.perpetuumsoft.com
software

Step 9
Create a new class. Right click on “WithoutBands” in the Solution Explorer, select
Add\Class… in the context menu.

Set class name – “Customer”, click “Add” button.

513
PERPETUUM www.perpetuumsoft.com
software

Class code:

public class Customer


{
public Customer()
{
}

private string company = String.Empty;


public string CompanyName
{
get
{
return company;
}
set
{
company = value;
}
}
private string address = String.Empty;
public string Address
{
get
{
return address;
}
set
{
address = value;
}
}
private string phone = String.Empty;
public string Phone

514
PERPETUUM www.perpetuumsoft.com
software

{
get
{
return phone;
}
set
{
phone = value;
}
}
private string contact = String.Empty;
public string ContactName
{
get
{
return contact;
}
set
{
contact = value;
}
}
}

Step 10
Go to the “Form1.cs” tab. Create instance of the Customer class. Write function to fill data
source with the values from the DataGridView table.

private Customer customer = new Customer();


private void SetData()
{
customer.Address = dataGridView1[3,
dataGridView1.CurrentRow.Index].Value.ToString();
customer.CompanyName = dataGridView1[0,
dataGridView1.CurrentRow.Index].Value.ToString();
customer.ContactName = dataGridView1[1,
dataGridView1.CurrentRow.Index].Value.ToString();
customer.Phone = dataGridView1[2,
dataGridView1.CurrentRow.Index].Value.ToString();
reportManager1.DataSources.Add("Customer",customer );
}

Step 11
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

515
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button on the form. Add
code launching report generation to the event handler. For example, use the following code:

private void button1_Click(object sender, EventArgs e)


{
SetData();
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
SetData();
inlineReportSlot1.Prepare();
}

Step 12
Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

516
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 13
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 14
Double click on ReportManager to open ReportManager editor.

On the “Reports” tab, click “Add” and select “InlineReportSlot”.

517
PERPETUUM www.perpetuumsoft.com
software

Step 15
Set name of the report in the property ReportName – “WithoutBands”.

Click “Run Designer” in order to open template editor – “Report Designer”.

518
PERPETUUM www.perpetuumsoft.com
software

Step 16
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

519
PERPETUUM www.perpetuumsoft.com
software

Step 17
Click the “Properties” tab of the tool window in the right part of the designer.

520
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

521
PERPETUUM www.perpetuumsoft.com
software

Step 18
Press button “TextBox” on the Insert tab in the group Text.

Click on the template area to add TextBox element to the template. In the same way add
three more TextBox elements.

Step 19
Open Script Browser - press the “Script Browser” button in the Home tab in the Scripts
group.

Right click on textBox1 in DocumentTree. Select Bindings\Value in the context menu.

522
PERPETUUM www.perpetuumsoft.com
software

Write the “GetData("Customer.CompanyName")” script in the appeared window.

Step 20
Set the Value property to “GetData("Customer.Address")”,
“GetData("Customer.ContactName")”, “GetData("Customer.Phone")” for other TextBoxes in
the same way.

Press the “Save all” button.

523
PERPETUUM www.perpetuumsoft.com
software

Close Script Browser.

Step 21
Press Shift and select all the elements by the left mouse button. Click “Left Alignment”
button on the Home tab in the group Alignment.

Change size of the elements and set positions in the following way:

Step 22
Save template, close Report Designer.

Step 23
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["Address"] = "Obere Str. 57";
row["ContactName"] = "Maria Anders";
row["Phone"] = "030-0074321";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";

524
PERPETUUM www.perpetuumsoft.com
software

row["Address"] = "Avda. de la Constitución 2222";


row["ContactName"] = "Ana Trujillo";
row["Phone"] = "(5) 555-4729";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["Address"] = "Kirchgasse 6";
row["ContactName"] = "Roland Mendel";
row["Phone"] = "7675-3425";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["Address"] = "Luisenstr. 48";
row["ContactName"] = "Karin Josephs";
row["Phone"] = "0251-031259";
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
PerpetuumSoft.Reporting.Components.IReportSource rs = sender as
PerpetuumSoft.Reporting.Components.IReportSource;
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(rs))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 24
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

On the application form, select any record and click “Report” button to open card with the
information on the selected company.

Generated report is viewed in the Report Viewer.

525
PERPETUUM www.perpetuumsoft.com
software

To edit report template, close Report Viewer and click “Template” on the application form.

Similar application sample is located in the following folder “\Perpetuum Software\Net


ModelKit Suite\ Samples\Report Sharp-Shooter\CSharp\WithoutBands”.

Similar sample in the Samples Center is Reports\Simple Reports\Without Bands.

526
PERPETUUM www.perpetuumsoft.com
software

Parameterized Report
Template of a report containing date and time set by the user.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Parameters”, set directory to save
the project to.

527
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Parameters Properties… item in the main
menu.

Select item Target framework\.NET Framework4 from the tab Application.

In the opened window press the “Yes” button.

528
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

529
PERPETUUM www.perpetuumsoft.com
software

Step 4
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 5
Double click on ReportManager to open ReportManager editor.

530
PERPETUUM www.perpetuumsoft.com
software

On the “Reports” tab, click “Add” and select “InlineReportSlot”.

Step 6
Set name of the report in the property ReportName – “Parameters”.

Click “Run Designer” in order to open template editor – Report Designer.

531
PERPETUUM www.perpetuumsoft.com
software

Step 7
Create new empty template – select item File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

532
PERPETUUM www.perpetuumsoft.com
software

Step 8
Click the “Properties” tab of the tool window in the right part of the designer.

533
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

534
PERPETUUM www.perpetuumsoft.com
software

Step 9
Select Parameters property, click button to open collection editor.

In the Collection Editor, click button to add a new parameter. Set property Name =
Date.

In the same way add one more parameter and set property Name = Number.

Step 10
Press “Detail” button on the Insert tab in the group Container.

535
PERPETUUM www.perpetuumsoft.com
software

Click on the template area to add Detail band to the report template.

Step 11
Press button “TextBox” on the Insert tab in the group Text.

Click on the Detail band area to add TextBox element inside Detail. Set Text property to
“Date”.

Step 12
Add three more TextBox elements to the Detail band. Set the following properties for the
first one: set Value = GetParameter("Date").

For the second one, set property Text = Number. For the third one, reset Text property and
set Value to “GetParameter("Number")”.

Step 13
Save template, close Report Designer.

Step 14
Place two Label elements onto the form (drag and drop “Label” element from the Toolbox to
the form).

536
PERPETUUM www.perpetuumsoft.com
software

Select Label element on the form, select Text property. Set Text = Date for the first one,
set Text = Number for the second one.

Step 15
Add two TextBox elements onto the form (drag and drop “TextBox” element from the
Toolbox onto the form).

537
PERPETUUM www.perpetuumsoft.com
software

Select TextBox element on the form, edit Name property on the property grid. Set Name =
dateTextBox for the first one, set Name = numberTextBox for the second one.

538
PERPETUUM www.perpetuumsoft.com
software

Step 16
Right click on the form and select “View Code” in the context menu to view code.

Add code to fill form fields and display report to the class constructor. Create
RenderComplited event handler of the InlineReportSlot object.

public Form1()
{
InitializeComponent();
dateTextBox.Text = DateTime.Now.ToString();
numberTextBox.Text = Environment.TickCount.ToString();
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 17
Add code to pass parameters to the report to the class constructor, create
GetReportParameter event handler:

public Form1()
{
InitializeComponent();
dateTextBox.Text = DateTime.Now.ToString();
numberTextBox.Text = Environment.TickCount.ToString();
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
inlineReportSlot1.GetReportParameter += new
PerpetuumSoft.Reporting.Components.GetReportParameterEventHandler(inlineRepor
tSlot1_GetReportParameter);

539
PERPETUUM www.perpetuumsoft.com
software

}
private void inlineReportSlot1_GetReportParameter(object sender,
PerpetuumSoft.Reporting.Components.GetReportParameterEventArgs e)
{
e.Parameters["Date"].Value = dateTextBox.Text;
e.Parameters["Number"].Value = numberTextBox.Text;
}

Step 18
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button on the form. Add
code launching report generation to the event handler. For example, use the following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();

540
PERPETUUM www.perpetuumsoft.com
software

Step 19
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Application form appears.

Date and Number fields can be edited. When you click “Report” button, the report is
generated and can be viewed in Report Viewer. Values from the fields are passed to the
report as parameters.

541
PERPETUUM www.perpetuumsoft.com
software

To edit report template click “Template” on the application form.

Similar application sample is located in the following folder “\Perpetuum Software\Net


ModelKit Suite\ Samples\Report Sharp-Shooter\CSharp\DocumentParametersUsing”.

542
PERPETUUM www.perpetuumsoft.com
software

Multicolumn Report
Template of a report containing a list of clients (company name and phone) in two columns.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Columns”, set directory to save the
project to.

543
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Columns Properties… item in the main
menu.

Select item Target framework\.NET Framework4 from the tab Application.

In the opened window press the “Yes” button.

544
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

Select “Untyped dataset”, click «OK”

545
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

Click “Add” in order to add table. Set property TableName = Customers.

546
PERPETUUM www.perpetuumsoft.com
software

Step 5
Select Columns property, click button in order to open property editor.

Click “Add” to add a new column. Add two columns. Set ColumnName property to
“CompanyName”, “Phone” correspondingly.

547
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor in order to fill data source.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";

548
PERPETUUM www.perpetuumsoft.com
software

row["Phone"] = "030-0074321";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["Phone"] = "(5) 555-4729";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["Phone"] = "7675-3425";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["Phone"] = "0251-031259";
dataTable1.Rows.Add(row);
}
To see how the list is divided into two columns add more data.

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

549
PERPETUUM www.perpetuumsoft.com
software

Step 8
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 9
Double click on ReportManager to open ReportManager editor.

Go to “Data sources” tab, click “Add”, set Data source name – “Customers”, select data
source Value – “dataSet1.Customers”.

550
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

551
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in the property ReportName – “Columns”.

Click “Run Designer” in order to open template editor – Report Designer.

552
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

553
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

554
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

555
PERPETUUM www.perpetuumsoft.com
software

Step 14
Press “DataBand” button on the Insert tab in the group Container.

Click on the template area to add DataBand section to the template.

Set data source in the property DataSource = Customers.

Set the following properties: ColumnsCount = 2, ColumnsGap = 0,5 см.

Step 15
Press “Detail” button on the Insert tab in the group Container.

556
PERPETUUM www.perpetuumsoft.com
software

Click on the DataBand area to add Detail band inside DataBand.

Step 16
Go to “DataSources” tab.

557
PERPETUUM www.perpetuumsoft.com
software

Drag and drop “CompanyName”, “Phone” fields from the dataBand1 tree to the detail1
band. As a result TextBoxes are created. Value property is automatically filled with script
loading data from the data source.

Change size of the elements and locate them so that they don’t exceed the red line
determining column border.

Step 17
Save template, close Report Designer.

Step 18
Add code to display report to the class constructor. Write RenderComplited event handler of
the InlineReportSlot object.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["Phone"] = "030-0074321";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ana Trujillo Emparedados y helados";
row["Phone"] = "(5) 555-4729";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Ernst Handel";
row["Phone"] = "7675-3425";
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Toms Spezialitäten";
row["Phone"] = "0251-031259";
dataTable1.Rows.Add(row);
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 19
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

558
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button element on the
form. Add code launching report generation to the event handler. For example, use the
following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 20
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

559
PERPETUUM www.perpetuumsoft.com
software

Generated report is viewed in the Report Viewer.

To edit report template, close Report Viewer and click “Template” on the application form.

560
PERPETUUM www.perpetuumsoft.com
software

Similar sample in the Samples Center is Reports\Simple Reports\MultiColumn.

561
PERPETUUM www.perpetuumsoft.com
software

Horizontal List
Template of a report containing positive whole numbers in a line.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “CrossBand”, set directory to save
the project to.

562
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\CrossBand Properties… item in the main
menu.

Select item Target framework\.NET Framework4 from the tab Application.

In the opened window press the “Yes” button.

563
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

564
PERPETUUM www.perpetuumsoft.com
software

Step 4
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 5
Double click on ReportManager to open ReportManager editor.

565
PERPETUUM www.perpetuumsoft.com
software

On the “Reports tab”, click “Add” and select “InlineReportSlot”.

Step 6
Set name of the report in the property ReportName – “CrossBand”.

Click “Run Designer” in order to open template editor - Report Designer.

566
PERPETUUM www.perpetuumsoft.com
software

Step 7
Create new empty template – select item File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

567
PERPETUUM www.perpetuumsoft.com
software

Step 8
Click the “Properties” tab of the tool window in the right part of the designer.

568
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

569
PERPETUUM www.perpetuumsoft.com
software

Step 9
Press “Detail” button on the Insert tab in the group Container.

Click on the template area to add Detail band to the template.

Step 10
Press “CrossBand” button on the Insert tab in the group Container.

Click on the Detail band area to add CrossBand inside Detail.

Set property InstanceCount = 10

Step 11
Press button “TextBox” on the Insert tab in the group Text.

570
PERPETUUM www.perpetuumsoft.com
software

Click on the CrossBand area to add TextBox element inside CrossBand. Set property Value
= crossBand1.LineNumber.

Report template should look as follows:

Step 12
Save template, close Report Designer.

Step 13
Right click on the application form and select “View Code” in the context menu to view code.

Add code to display report to the class constructor. Create RenderComplited event handler
of the InlineReportSlot object.

public Form1()
{
InitializeComponent();
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);

571
PERPETUUM www.perpetuumsoft.com
software

}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 14
Get back to the application from by clicking “Form1.cs[Design]” tab.

Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

572
PERPETUUM www.perpetuumsoft.com
software

Create Click event handlers for the buttons – double click on the Button on the form. Add
code launching report generation to the event handler. For example, use the following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 15
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

Generated report is viewed in the Report Viewer.

573
PERPETUUM www.perpetuumsoft.com
software

To edit report template, close Report Viewer and click “Template” on the application form.

574
PERPETUUM www.perpetuumsoft.com
software

Matrix
Template of a report containing multiplication table as matrix.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “Matrix”, set directory to save the
project to.

575
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\Matrix Properties… item in the main menu.

Select item Target framework\.NET Framework4 from the tab Application.

In the opened window press the “Yes” button.

576
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

577
PERPETUUM www.perpetuumsoft.com
software

Step 4
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 5
Double click on ReportManager to open ReportManager editor.

578
PERPETUUM www.perpetuumsoft.com
software

On the “Reports tab”, click “Add” and select “InlineReportSlot”.

Step 6
Set name of the report in the property ReportName – “Matrix”.

Click “Run Designer” in order to open template editor - Report Designer.

579
PERPETUUM www.perpetuumsoft.com
software

Step 7
Create new empty template – select item File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

580
PERPETUUM www.perpetuumsoft.com
software

Step 8
Click the “Properties” tab of the tool window in the right part of the designer.

581
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

582
PERPETUUM www.perpetuumsoft.com
software

Step 9
Press “Detail” button on the Insert tab in the group Container.

Click on the template area to add Detail band to the template.

Step 10
Press “CrossBand” button on the Insert tab in the group Container.

Click on the Detail band area to add CrossBand inside Detail. Set InstanceCount property to
“1”.

Step 11
Press button “TextBox” on the Insert tab in the group Text.

Click on the CrossBand area to add TextBox element inside CrossBand.

Set property Text = X * Y.

583
PERPETUUM www.perpetuumsoft.com
software

Select Border property. Click button to open Border Editor. Set element border.

Step 12
Add another CrossBand inside detail1 band on the right of crossBand1. Set InstanceCount
property to “8”.

Step 13
Add TextBox element inside crossBand2. Set property Value = crossBand2.LineNumber+1.

Set Border property as shown in step 10.

584
PERPETUUM www.perpetuumsoft.com
software

Step 14
Press “DataBand” button on the Insert tab in the group Container.

Click template area to add DataBand to the template. Set property InstanceCount = 8.

Step 15
Add Detail band inside dataBand1. In detail2, add CrossBand so that it is positioned left
below crossBand1. Set property InstanceCount = 1.

Step 16
Add TextBox element to the crossBand3. Set Value property to dataBand1.LineNumber+1.
Set Border property as shown in step 10.

Step 17
Add another CrossBand inside detail2 so that it is located right below crossBand2. Set
property InstanceCount = 8.

Step 18
Add TextBox to the crossBand4. Set Value property to
(dataBand1.LineNumber+1)*(crossBand4.LineNumber+1). Set Border property as shown in
the Step 11.

585
PERPETUUM www.perpetuumsoft.com
software

Report template should look as follows:

To view template structure go to “DocumentTree” tab.

586
PERPETUUM www.perpetuumsoft.com
software

Step 19
Save template, close Report Designer.

Step 20
Right click on the application form and select “View Code” in the context menu to view code.

587
PERPETUUM www.perpetuumsoft.com
software

Add code to display report to the class constructor. Create RenderComplited event handler
of the InlineReportSlot object.

public Form1()
{
InitializeComponent();
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 21
Get back to the application form by clicking “Form1.cs[Design]” tab.

Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

588
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button on the form. Add
code launching report generation to the event handler. For example, use the following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 22
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

589
PERPETUUM www.perpetuumsoft.com
software

Generated report is viewed in the Report Viewer.

To edit report template, close Report Viewer and click “Template” on the application form.

590
PERPETUUM www.perpetuumsoft.com
software

Similar sample in the Samples Center is Reports\Special Features\Cross-tab report.

591
PERPETUUM www.perpetuumsoft.com
software

Pivot Table
Template of a report containing pivot table with sales data. Vertical header contains
information on categories and goods, horizontal header – customer names, table data –
goods price considering amount and discount.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “PivotTable”, set directory to save
the project to.

592
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\PivotTable Properties… item in the main
menu.

Select item Target framework\.NET Framework4 from the tab Application.

593
PERPETUUM www.perpetuumsoft.com
software

In the opened window press the “Yes” button.

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click “DataSet” element on the Toolbox and place DataSet onto the form.

594
PERPETUUM www.perpetuumsoft.com
software

Select “Untyped dataset”, click “OK”.

The component is available in the lower part of the window.

Step 4
Select dataSet1 in the form editor. On the property grid, select Tables property, click button
in order to open property editor.

595
PERPETUUM www.perpetuumsoft.com
software

Click “Add” in order to add table. Set property TableName = Sales.

Step 5
Select Columns property, click button in order to open property editor.

Click “Add” to add a new column. Add six columns. Set ColumnName property to
“CompanyName”, “CategoryName”, “ProductName”, “UnitPrice”, “Quantity”, “Discount”
correspondingly. For the “UnitPrice”, “Quantity”, “Discount” columns set DataType property
to “System.Double”.

596
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu to view code.

Add the following code to the class constructor in order to fill data source.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";

597
PERPETUUM www.perpetuumsoft.com
software

row["CategoryName"] = "Beverages";
row["ProductName"] = "Chai";
row["UnitPrice"] = 35.5;
row["Quantity"] = 15;
row["Discount"] = 0.05;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["CategoryName"] = "Beverages";
row["ProductName"] = "Steeleye Stout";
row["UnitPrice"] = 105;
row["Quantity"] = 5;
row["Discount"] = 0;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["CategoryName"] = "Confections";
row["ProductName"] = "Maxilaku";
row["UnitPrice"] = 2.6;
row["Quantity"] = 50;
row["Discount"] = 0;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["CategoryName"] = "Dairy Products";
row["ProductName"] = "Geitost";
row["UnitPrice"] = 15.8;
row["Quantity"] = 10;
row["Discount"] = 0.02;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["CategoryName"] = "Dairy Products";
row["ProductName"] = "Flotemysost";
row["UnitPrice"] = 240;
row["Quantity"] = 10;
row["Discount"] = 0.06;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["CategoryName"] = "Dairy Products";
row["ProductName"] = "Raclette Courdavault";
row["UnitPrice"] = 62.5;
row["Quantity"] = 15;
row["Discount"] = 0;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Karkki Oy";
row["CategoryName"] = "Beverages";
row["ProductName"] = "Chai";
row["UnitPrice"] = 35.5;
row["Quantity"] = 15;
row["Discount"] = 0.04;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Karkki Oy";
row["CategoryName"] = "Beverages";
row["ProductName"] = "Ipoh Coffee";
row["UnitPrice"] = 50.5;
row["Quantity"] = 20;
row["Discount"] = 0;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();

598
PERPETUUM www.perpetuumsoft.com
software

row["CompanyName"] = "Karkki Oy";


row["CategoryName"] = "Grains/Cereals";
row["ProductName"] = "Filo Mix";
row["UnitPrice"] = 14;
row["Quantity"] = 25;
row["Discount"] = 0.05;
dataTable1.Rows.Add(row);
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

Step 8
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

599
PERPETUUM www.perpetuumsoft.com
software

Step 9
Double click on ReportManager to open ReportManager editor.

Go to “Data sources” tab, click “Add”, and set data source name – “Sales”, select data
source value – “dataSet1.Sales”.

600
PERPETUUM www.perpetuumsoft.com
software

Step 10
Go to “Reports” tab, click “Add” and select “InlineReportSlot”.

601
PERPETUUM www.perpetuumsoft.com
software

Step 11
Set name of the report in the property ReportName – “PivotTable”.

Click “Run Designer” in order to open template editor – Report Designer.

602
PERPETUUM www.perpetuumsoft.com
software

Step 12
Create new empty template – select File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

603
PERPETUUM www.perpetuumsoft.com
software

Step 13
Click the “Properties” tab of the tool window in the right part of the designer.

604
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

605
PERPETUUM www.perpetuumsoft.com
software

Step 14
Create style for the pivot table.

Press the “Edit Style” button on the Home tab in the group Styles.

In the Style Sheet Editor, click button to add a new style.

Set property Name = PivotTable. Select Border property, click button to open property
editor. Set borders.

606
PERPETUUM www.perpetuumsoft.com
software

Step 15
Press “PivotTable” button on the Insert tab in the group Container.

Click on the template area to add PivotTable to the template.

Set data source in the property DataSource = Sales.

607
PERPETUUM www.perpetuumsoft.com
software

Step 16
Drag and drop “CompanyName” field from the “Source fields” list to “X dimension fields”.
Drag and drop “CategoryName” and “ProductName” to “Y dimension fields”. Edit Caption
property and set only “Company”, “Category”, “Product”.

Step 17
In the Source fields editor, click button for the “Facts fields”. A new field will be added
and its properties will be visible in the right part of the window.

608
PERPETUUM www.perpetuumsoft.com
software

Set the following properties:

Caption = Sales sum

Format = 0.00

TotalLabel = Total price

Width = 150.

Select Expression property, click button to open Script Editor.

Set the following expression in the editor:


“(double)GetData("Sales.UnitPrice")*(double)GetData("Sales.Quantity")*(1-
(double)GetData("Sales.Discount"))”

609
PERPETUUM www.perpetuumsoft.com
software

Step 18
Select PivotTable element. Expand Style list on the property grid. Select PivotTable style for
all types of cells. Set the TableCaption property = Sales.

Report template should look as follows:

610
PERPETUUM www.perpetuumsoft.com
software

Step 19
Save template, close Report Designer.

Step 20
Add code to display report to the class constructor.

public Form1()
{
InitializeComponent();
DataRow row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["CategoryName"] = "Beverages";
row["ProductName"] = "Chai";
row["UnitPrice"] = 35.5;
row["Quantity"] = 15;
row["Discount"] = 0.05;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["CategoryName"] = "Beverages";
row["ProductName"] = "Steeleye Stout";
row["UnitPrice"] = 105;
row["Quantity"] = 5;
row["Discount"] = 0;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["CategoryName"] = "Confections";
row["ProductName"] = "Maxilaku";
row["UnitPrice"] = 2.6;
row["Quantity"] = 50;
row["Discount"] = 0;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["CategoryName"] = "Dairy Products";
row["ProductName"] = "Geitost";
row["UnitPrice"] = 15.8;
row["Quantity"] = 10;
row["Discount"] = 0.02;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["CategoryName"] = "Dairy Products";
row["ProductName"] = "Flotemysost";
row["UnitPrice"] = 240;
row["Quantity"] = 10;
row["Discount"] = 0.06;
dataTable1.Rows.Add(row);

611
PERPETUUM www.perpetuumsoft.com
software

row = dataTable1.NewRow();
row["CompanyName"] = "Alfreds Futterkiste";
row["CategoryName"] = "Dairy Products";
row["ProductName"] = "Raclette Courdavault";
row["UnitPrice"] = 62.5;
row["Quantity"] = 15;
row["Discount"] = 0;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Karkki Oy";
row["CategoryName"] = "Beverages";
row["ProductName"] = "Chai";
row["UnitPrice"] = 35.5;
row["Quantity"] = 15;
row["Discount"] = 0.04;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Karkki Oy";
row["CategoryName"] = "Beverages";
row["ProductName"] = "Ipoh Coffee";
row["UnitPrice"] = 50.5;
row["Quantity"] = 20;
row["Discount"] = 0;
dataTable1.Rows.Add(row);
row = dataTable1.NewRow();
row["CompanyName"] = "Karkki Oy";
row["CategoryName"] = "Grains/Cereals";
row["ProductName"] = "Filo Mix";
row["UnitPrice"] = 14;
row["Quantity"] = 25;
row["Discount"] = 0.05;
dataTable1.Rows.Add(row);
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
inlineReportSlot1.RenderDocument();
previewForm.ShowDialog(this);
}
}

Step 21
Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

612
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button on the form. Add
code launching report generation to the event handler. For example, use the following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 22
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

Generated report is viewed in the Report Viewer.

613
PERPETUUM www.perpetuumsoft.com
software

To edit report template, close Report Viewer and click “Template” on the application form.

Similar application sample is located in the following folder “\Perpetuum Software\Net


ModelKit Suite\Samples\Report Sharp-Shooter\CSharp\PivotTableGettingStarted”.

614
PERPETUUM www.perpetuumsoft.com
software

Subreports
Template of a report containing three subreports – reports containing charts, gauges and
shapes. Any report can be used as subreport. Before you create master report, design
necessary templates and save them to files.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “SubReport”, set directory to save
the project to.

615
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\SubReport Properties… item in the main
menu.

Select item Target framework\.NET Framework4 from the tab Application.

616
PERPETUUM www.perpetuumsoft.com
software

In the opened window press the “Yes” button.

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

617
PERPETUUM www.perpetuumsoft.com
software

The component is available in the lower part of the window.

Step 4
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 5
Double click on ReportManager to open ReportManager editor.

618
PERPETUUM www.perpetuumsoft.com
software

On the “Reports” tab, click “Add” and select “FileReportSlot”.

Step 6
Set name of the report in property ReportName = “ChartTypes”. Select FilePath property,
click button to open dialog to select report template.

Select previously saved report template “ChartTypes” and click “OK”.

619
PERPETUUM www.perpetuumsoft.com
software

In the same way add two more report templates previously saved, set properties
ReportName = InstrumentsType and ReportName = Shapes.

Step 7
Click “Add” and select “InlineReportSlot”.

620
PERPETUUM www.perpetuumsoft.com
software

Set property ReportName = SubReport.

621
PERPETUUM www.perpetuumsoft.com
software

Click “Run Designer” in order to open template editor - Report Designer.

Step 8
Create new empty template – select item File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

622
PERPETUUM www.perpetuumsoft.com
software

Step 9
Click the “Properties” tab of the tool window in the right part of the designer.

623
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

624
PERPETUUM www.perpetuumsoft.com
software

Step 10
Press “Detail” button on the Insert tab in the group Container.

Click on the template area to add Detail band to the template.

Step 11
Press button “TextBox” on the Insert tab in the group Text.

Step 12
Click on the Detail band area to add TextBox element inside it. Set the following properties:
Text = “ModelKit Suite”, Font.Size = 30.

Step 13
Press “SubReport” button on the Insert tab in the group Container.

625
PERPETUUM www.perpetuumsoft.com
software

Click on the template area to add SubReport band to the template.

Set property TemplateName = “ChartTypes”.

Step 14
In the same way add two more SubReport bands. Set property TemplateName to
“InstrumentsTypes” and “Shapes”.

Step 15
Save template, close Report Designer.

Step 16
Right click on the application form and select “View Code” in the context menu to view code.

626
PERPETUUM www.perpetuumsoft.com
software

Add code to display report to the class constructor. Create RenderComplited event handler
of the InlineReportSlot object.

public Form1()
{
InitializeComponent();
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 17
Get back to the application form by clicking “Form1.cs[Design]” tab.

Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

627
PERPETUUM www.perpetuumsoft.com
software

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button on the form. Add
code launching report generation to the event handler. For example, use the following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 18
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

628
PERPETUUM www.perpetuumsoft.com
software

Generated report is viewed in the Report Viewer.

To edit report template, close Report Viewer and click “Template” on the application form.

629
PERPETUUM www.perpetuumsoft.com
software

Similar sample in the Samples Center is Reports\Sub-Reports\The use of sub-reports.

630
PERPETUUM www.perpetuumsoft.com
software

Master Report
Application provides the ability to select header and contents of the report.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “MasterReport”, set directory to save
the project to.

631
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\MasterReport Properties… item in the main
menu.

Select item Target framework\.NET Framework4 from the tab Application.

In the opened window press the “Yes” button.

632
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

633
PERPETUUM www.perpetuumsoft.com
software

Step 4
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 5
Double click on ReportManager to open ReportManager editor.

634
PERPETUUM www.perpetuumsoft.com
software

On the “Reports” tab, click “Add” and select “InlineReportSlot”.

Set name of the report in property ReportName = Master1. Click “Run Designer” in order to
open template editor - ReportDesigner.

635
PERPETUUM www.perpetuumsoft.com
software

Step 6
Create new empty template – select item File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

636
PERPETUUM www.perpetuumsoft.com
software

Step 7
Click the “Properties” tab of the tool window in the right part of the designer.

637
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

638
PERPETUUM www.perpetuumsoft.com
software

Step 8
Press “Detail” button on the Insert tab in the group Container.

Click on the template area to add Detail band to the template.

Step 9
Press button “TextBox” on the Insert tab in the group Text.

Click on the Detail band area to add TextBox element inside it. Set property Text = Master
Report.

Step 10
Press “Picture” button on the Insert tab in the group Illustration.

Click on the Detail band area to add Picture element inside Detail.

Select Image property, click button .

639
PERPETUUM www.perpetuumsoft.com
software

Select file.

Step 11
Press “Content” button on the Insert tab in the group Container.

Click on the template area to add this band to the template.

Step 12
Save template, close Report Designer.

Step 13
Add one more template in the ReportManager editor. Open Report Designer. Set property
ReportName = Master2. Open Report Designer.

640
PERPETUUM www.perpetuumsoft.com
software

Step 14
Create a template similar to the first one, but without a picture. Report template should look
as follows:

Save template, close Report Designer.

Step 15
Add one more template in the ReportManager editor. Set property ReportName = Shapes.

Step 16
Open Report Designer. Open report properties. Set property MasterReport = Master.

641
PERPETUUM www.perpetuumsoft.com
software

Add Detail bands to the template, add Shape and TextBox elements inside Detail bands.
Save template, close Report Designer.

Step 17
Add one more template in the ReportManager editor. Open Report Designer. Set property
Name = Instruments. Open report properties. Set property MasterReport = Master. Add
Detail bands to the template, add TextBox and Widget elements inside Detail bands. Click
on the Widget element and open Instrumentation ModelKit, design widget. Save template,
close Report Designer.

Step 18
Right click on the application form and select “View Code” in the context menu to view code.

642
PERPETUUM www.perpetuumsoft.com
software

Add code to display report to the class constructor. Create RenderComplited event handler
of the InlineReportSlot object.

public Form1()
{
InitializeComponent();
inlineReportSlot3.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
inlineReportSlot4.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}

private void reportSlot_RenderCompleted(object sender, EventArgs e)


{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm((PerpetuumSoft.Reporting.Components.
IReportSource)sender))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

Step 19
Get back to the application form by clicking “Form1.cs[Design]” tab.

Step 20
Add two Label elements onto the form (drag and drop “Label” element from the Toolbox
onto the form).

643
PERPETUUM www.perpetuumsoft.com
software

Select Label on the form, edit Text property on the property grid. Set Text = Caption for
one label and Text = Report for the second.

Step 21
Add two ComboBox elements onto the form (drag and drop “ComboBox” element from the
Toolbox onto the form).

644
PERPETUUM www.perpetuumsoft.com
software

Place elements so that comboBox1 is located next to the “Caption” label and comboBox2 is
located next to the “Report” label.

645
PERPETUUM www.perpetuumsoft.com
software

View code and add class constructor to fill lists.

public Form1()
{
InitializeComponent();
comboBox1.Items.Add("With logo");
comboBox1.Items.Add("Without logo");
comboBox2.Items.Add("Shapes");
comboBox2.Items.Add("Instruments");
inlineReportSlot3.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
inlineReportSlot4.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}

Step 22
Add three buttons onto the form (drag and drop “Button” element from the Toolbox onto
the form).

Select the second Button element on the form, edit its Text property. For the first
and second one, set Text = Template; for the third, set Text = Report.

Create Click event handlers – double click on the Button element on the form. Add
code launching report generation. Depending on the selected values in ComboBox
elements, Template buttons will open different templates in the Report Designer.
Final report will be generated depending on the selected values.

646
PERPETUUM www.perpetuumsoft.com
software

private void button1_Click(object sender, EventArgs e)


{
if (comboBox1.SelectedIndex == 0)
inlineReportSlot1.DesignTemplate();
if (comboBox1.SelectedIndex == 1)
inlineReportSlot2.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)


{
if (comboBox2.SelectedIndex == 0)
inlineReportSlot3.DesignTemplate();
if (comboBox2.SelectedIndex == 1)
inlineReportSlot4.DesignTemplate();
}

private void button3_Click(object sender, EventArgs e)


{
if (comboBox1.SelectedIndex == 0)
{
inlineReportSlot1.ReportName = "Master";
inlineReportSlot2.ReportName = "Master2";
}
else
{
inlineReportSlot1.ReportName = "Master1";
inlineReportSlot2.ReportName = "Master";
}
if (comboBox2.SelectedIndex == 0) inlineReportSlot3.Prepare();
if (comboBox2.SelectedIndex == 1) inlineReportSlot4.Prepare();
}

Step 23
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Application form runs.

647
PERPETUUM www.perpetuumsoft.com
software

Click “Template” button and you will open Report Designer with a template selected in the
corresponding ComboBox.

Click “Report” button and the final report will be generated; and document header will be
generated by the template selected in the Caption section, and the document itself will be
generated by the template selected in the Report section.

Similar sample in the Samples Center is Reports\Master Report.

648
PERPETUUM www.perpetuumsoft.com
software

Side by Side Report


Template of a report containing a table – first column contains numbers from 1 to 20, and
the second one contains numbers from 1 to 10.

Step 1
Create new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set project name – “SideBySide”, set directory to save
the project to.

649
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\SideBySide Properties… item in the main
menu.

Select item Target framework\.NET Framework4 from the tab Application.

In the opened window press the “Yes” button.

650
PERPETUUM www.perpetuumsoft.com
software

Step 3
Open main form of the application by double click on the “Form1.cs” in the Solution
Explorer.

Click on the “ReportManager” on the Toolbox and place this component onto the form. This
component is designed to store collections of report templates and data sources.

The component is available in the lower part of the window.

651
PERPETUUM www.perpetuumsoft.com
software

Step 4
On the property grid, initialize OwnerForm property of the ReportManager by selecting the
form it is located on.

Step 5
Double click on ReportManager to open ReportManager editor.

652
PERPETUUM www.perpetuumsoft.com
software

On the “Reports” tab, click “Add” and select “InlineReportSlot”.

Step 6
Set name of the report in the property ReportName – “SideBySide”.

Click “Run Designer” in order to open template editor – Report Designer.

653
PERPETUUM www.perpetuumsoft.com
software

Step 7
Create new empty template – select item File\New from the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

654
PERPETUUM www.perpetuumsoft.com
software

Step 8
Click the “Properties” tab of the tool window in the right part of the designer.

655
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

656
PERPETUUM www.perpetuumsoft.com
software

Step 9
Press “SideBySide” button on the Insert tab in the group Container.

Click on the template area to add this band to the template

Step 10
Press “DataBand” button on the Insert tab in the group Container.

Click on the SideBySide band area to add DataBand inside SideBySide band.

Set property InstanceCount = 20.

Step 11
Press “Detail” button on the Insert tab in the group Container.

Click on the DataBand area to add Detail band inside DataBand.

Step 12
Press button “TextBox” on the Insert tab in the group Text.

657
PERPETUUM www.perpetuumsoft.com
software

Click on the Detail band area to add TextBox element inside Detail band.

Select Border property, click button to open Border Editor.

Set borders of the TextBox element.

Change TextBox size. Set property Value = dataBand1.LineNumber.

Step 13
Add one more DataBand inside sideBySide1 band. Set InstanceCount = 10.

Step 14
Add Detail band inside dataBand2. Add TextBox element so that it is located on the right of
the TextBox from the dataBand1, set Border property. Set Value = dataBand2.LineNumber.
Change element size.

Report template should look as follows:

658
PERPETUUM www.perpetuumsoft.com
software

Step 15
Save template, close Report Designer.

Step 16
Right click on the application form and select “View Code” in the context menu to view code.

Add code to display report to the class constructor. Create RenderComplited event handler
of the InlineReportSlot object.

public Form1()
{
InitializeComponent();
inlineReportSlot1.RenderCompleted += new
EventHandler(reportSlot_RenderCompleted);
}
private void reportSlot_RenderCompleted(object sender, EventArgs e)
{
using (PerpetuumSoft.Reporting.View.PreviewForm previewForm = new
PerpetuumSoft.Reporting.View.PreviewForm(inlineReportSlot1))
{
previewForm.WindowState = FormWindowState.Maximized;
previewForm.ShowDialog(this);
}
}

659
PERPETUUM www.perpetuumsoft.com
software

Step 17
Get back to the application form by clicking “Form1.cs[Design]” tab.

Add two buttons onto the form (drag and drop “Button” element from the Toolbox onto the
form).

Select Button element on the form, edit Text property on the property grid. Set Text =
Template for one button and Text = Report for the other one.

Create Click event handlers for the buttons – double click on the Button on the form. Add
code launching report generation to the event handler. For example, use the following code:

private void button1_Click(object sender, EventArgs e)


{
inlineReportSlot1.DesignTemplate();
}

private void button2_Click(object sender, EventArgs e)

660
PERPETUUM www.perpetuumsoft.com
software

{
inlineReportSlot1.Prepare();
}

Step 18
Click “Start Debugging” on the Visual Studio toolbar in order to start application.

Click the “Report” button in the opened application window.

Generated report is viewed in the Report Viewer.

661
PERPETUUM www.perpetuumsoft.com
software

To edit report template, close Report Viewer and click “Template” on the application form.

Similar application sample is located in the following folder “\Perpetuum Software\Net


ModelKit Suite\Samples\Report Sharp-Shooter\CSharp\SideBySideUsing.rst”.

662
PERPETUUM www.perpetuumsoft.com
software

Using MS Charts in Report Sharp-Shooter 5.3+


In this example we will illustrate how to use MS Charts in Report Sharp Shooter.

Step 1
Create a new project in Microsoft Visual Studio. Select New\Project from the main menu.

Select Windows Forms Application, set name of the project – “MSChartSamples” and set
directory to save the project to.

663
PERPETUUM www.perpetuumsoft.com
software

Step 2
Change the project properties. Select the Project\MSChartSamples Properties… item in the
main menu.

Select the Target framework\.NET Framework4 item in the Application tab.

664
PERPETUUM www.perpetuumsoft.com
software

Press the “Yes” button in the opened window.

Step 3
Open main form of the application in the editor by double click on “Form1.cs” in the Solution
Explorer.

Click “DataSet” element in the Toolbox and place it onto the form.

665
PERPETUUM www.perpetuumsoft.com
software

Select “Untyped dataset”, click “OK”.

The component is displayed in the lower part of the window.

Step 4
Select dataSet1 component in the form editor. On the property grid, select “Tables”
property, press button in order to open Tables Collection Editor.

666
PERPETUUM www.perpetuumsoft.com
software

Press button “Add” in order to add a table. Set Name = tempOfSalesTable, TableName =
TempOfSales.

Step 5
Add the following columns: Year and Value are of the Int32 type.

667
PERPETUUM www.perpetuumsoft.com
software

Step 6
Right click on the form and select “View Code” in the context menu in order to view code.

Fill the DataSource with random information for a period from 2000 till current year-1. Add
the FillDataSource function for this purpose:

public Form1()
{
InitializeComponent();

668
PERPETUUM www.perpetuumsoft.com
software

FillDataSource();
}

private void FillDataSource()


{
// Let's add some data
Random random = new Random();
for (int year = 2000; year < DateTime.Now.Year; year++)
{
DataRow row = tempOfSalesTable.NewRow();
row["Year"] = year;
row["Value"] = random.Next(1000);
tempOfSalesTable.Rows.Add(row);
}
}

Step 7
Get back to the application form by clicking the “Form1.cs[Design]” tab.

Click “ReportManager” element on the Toolbox and place it onto the form. This element is
designed to store collections of report templates and data sources. Then click
“MSChartSupport” element on the Toolbox and place it onto the form.

669
PERPETUUM www.perpetuumsoft.com
software

Components are displayed in the lower part of the window.

Step 8
Double click on the ReportManager component and open ReportManager editor.

670
PERPETUUM www.perpetuumsoft.com
software

Go to “Data sources” tab, press “Add”, set name of the data source – “tempOfSales”, select
data source value – “tempOfSalesTable”.

Step 9
Go to “Reports” tab of the ReportManager editor, press “Add” and select “InlineReportSlot”.

671
PERPETUUM www.perpetuumsoft.com
software

Step 10
Set name of the report to “MsCharts” in the ReportName property.

Click “Run Designer” in order to open template editor – Report Designer.

672
PERPETUUM www.perpetuumsoft.com
software

Step 11
Create new empty template – select File\New in the main menu.

Select “Blank Report” in the Wizards Gallery and click “OK”.

673
PERPETUUM www.perpetuumsoft.com
software

Step 12
Click the “Properties” tab of the tool window in the right part of the designer.

674
PERPETUUM www.perpetuumsoft.com
software

You will see properties of the edited template on the “Properties” tab

Set property ScriptLanguage = CSharp.

Step 13
Press “MicrosoftChart” button on the Insert tab in the Illustration Container.

675
PERPETUUM www.perpetuumsoft.com
software

Step 14
Select the "tempOfSales" as the DataSource property value.

Step 15
Open the ChartAreas collection and add a Chart Area, keep all the parameters by default.

676
PERPETUUM www.perpetuumsoft.com
software

Step 16
Open Series collection and add a series. Select "Year" as XValueMember, "Value" as
YValueMember, set Name = Temp of sales. The ChartArea is set automatically as
"ChartArea1" after the editor is closed.

677
PERPETUUM www.perpetuumsoft.com
software

Step 17
Open the Titles collection, add a new Title, set Text = Temp of sales.

678
PERPETUUM www.perpetuumsoft.com
software

Step 18
Select the "FrameThin1" as the BorderSkin.SkinStyle.

679
PERPETUUM www.perpetuumsoft.com
software

Step 19
Save the template and close the Report Designer.

Step 20
Add ReportViewer onto the form.

680
PERPETUUM www.perpetuumsoft.com
software

Set the Source to inlineReportSlot1.

681
PERPETUUM www.perpetuumsoft.com
software

Step 21
In order to display the report on the startup, add the form’s Load event handler:

private void Form1_Load(object sender, EventArgs e)


{
inlineReportSlot1.Prepare();
}

Step 22
Run the application.

Configuring charts in Report Sharp-Shooter scripts.


There is some information to know in order to successfully work with Microsoft Charts using
Report Sharp-Shooter scripts:

The implementation of Charts in Report Sharp-Shooter isn't our own implementation. It


uses standard charts in the System.Windows.Forms.DataVizualization.Charting.Chart
library. A "wrapper" for all used classes is implemented for support integration. It allows the
user to use Charts inside Report Sharp-Shooter. Most of the wrapper-classes are inherited
from the standard classes and they add interfaces to Report Sharp-Shooter. Therefore there
are some requirements in order to successfully use the Charts.

Use the PerpetuumSoft.Reporting.MSChart.ChartModel namespace with the same type names instead
of the System.Windows.Forms.DataVisualization.Charting namespace.

682
PERPETUUM www.perpetuumsoft.com
software

Try to avoid the use of functions used to add objects into collections that automatically create an
object. In this case the object of a standard type will be created instead of the wrapped object.

It is not recommended to setup a chart using scripts if there is a possibility to do this


without scripts.

An example of configuring a chart using scripts.


In order to configure the chart using scripts as described above, use the following code. For
example, add the second chart to your report template and in the GenerateScript of the
chart you will have:

microsoftChart2.DataSource = "tempOfSales";

PerpetuumSoft.Reporting.MSChart.ChartModel.ChartArea chartArea = new


PerpetuumSoft.Reporting.MSChart.ChartModel.ChartArea();
chartArea.Name = "ChartArea1";
microsoftChart2.ChartAreas.Add(chartArea);

PerpetuumSoft.Reporting.MSChart.ChartModel.Series series = new


PerpetuumSoft.Reporting.MSChart.ChartModel.Series();
series.Name = "One more series";
series.XValueMember = "Year";
series.YValueMembers = "Value";
microsoftChart2.Series.Add(series);

PerpetuumSoft.Reporting.MSChart.ChartModel.Title title = new


PerpetuumSoft.Reporting.MSChart.ChartModel.Title();
title.Text = "Temp of sales";
microsoftChart2.Titles.Add(title);

microsoftChart2.BorderSkin.SkinStyle =
System.Windows.Forms.DataVisualization.Charting.BorderSkinStyle.FrameThin1;

683

You might also like