Stimulsoft Reports Programming Manual - en
Stimulsoft Reports Programming Manual - en
Table of Contents
Part I Introduction
1 Technical
...................................................................................................................................
Support
2
2 Trial License
...................................................................................................................................
Limitations
3
3 Information
...................................................................................................................................
in Web and References
3
Part II Data
1 Business
...................................................................................................................................
Objects in Net, Web, Silverlight
4
2 Business
...................................................................................................................................
Objects in WinRT
12
14
1 How to
...................................................................................................................................
Show Report?
15
2 Dot-Matrix
...................................................................................................................................
Viewer for WinForms
15
..........................................................................................................................................................
16
Setting Dot-Matrix
View er in WinForms
..........................................................................................................................................................
17
Dot-Matrix and
Escape Codes
18
1 How to
...................................................................................................................................
Show Report?
18
2 Dot-Matrix
...................................................................................................................................
Viewer for WPF
19
..........................................................................................................................................................
20
Dot-Matrix View
er Settings for WPF
21
DotMatrix and..........................................................................................................................................................
Escape Codes
22
1 How It...................................................................................................................................
Works?
23
2 How to
...................................................................................................................................
Run Web Reports Designer?
23
3 Loading
...................................................................................................................................
Reports to Web Designer
24
4 Report
...................................................................................................................................
Preview
26
5 Changing
...................................................................................................................................
Report Settings Before Rendering
27
6 Saving
...................................................................................................................................
Reports
27
7 Web Designer
...................................................................................................................................
Settings
29
Connection .......................................................................................................................................................... 29
Main Menu .......................................................................................................................................................... 30
..........................................................................................................................................................
31
Zooming Static
Properties
..........................................................................................................................................................
32
View er Static Properties
..........................................................................................................................................................
34
Additional View er Static Properties
8 Web Designer
...................................................................................................................................
Properties
35
9 Changing
...................................................................................................................................
Web Designer Properties From Code
36
10 Web Reports
...................................................................................................................................
Designer Localization
37
11 Visible
...................................................................................................................................
Mode
37
38
2003-2013 Stimulsoft
II
Stimulsoft Reports
1 Caching
................................................................................................................................... 38
38
RenderMode ..........................................................................................................................................................
Property
..........................................................................................................................................................
39
CacheMode Property
..........................................................................................................................................................
39
ServerTimeout Property
2 Printing
...................................................................................................................................
Reports
39
3 StiReportResponse
...................................................................................................................................
Class
40
4 Using...................................................................................................................................
Dialogs in Report
40
5 Images
...................................................................................................................................
of StiWebViewer Toolbar
41
6 Localization
...................................................................................................................................
of StiWebViewer Component
41
41
1 How It...................................................................................................................................
Works?
41
2 How to
...................................................................................................................................
Run Designer?
42
3 How to
...................................................................................................................................
Load Reports in Web-Designer?
43
4 Previewing
...................................................................................................................................
Reports
43
5 Exporting
...................................................................................................................................
Reports From Preview
46
6 Showing
...................................................................................................................................
C#/VB.NET Report Code
48
7 Changing
...................................................................................................................................
Report Parameters Before Rendering
48
8 Saving
...................................................................................................................................
Reports
49
9 Localizing
...................................................................................................................................
Web Designer
51
10 Other...................................................................................................................................
Actions of Web Designer
52
11 Web Designer
...................................................................................................................................
Settings
54
.......................................................................................................................................................... 54
Actions
Connection .......................................................................................................................................................... 55
.......................................................................................................................................................... 55
Dialog Box About
.......................................................................................................................................................... 56
Dictionary
Main Menu .......................................................................................................................................................... 57
.......................................................................................................................................................... 59
Toolbars
.......................................................................................................................................................... 60
Zooming
.......................................................................................................................................................... 60
Interface
.......................................................................................................................................................... 60
Miscellaneous
.......................................................................................................................................................... 61
View er
Exporting ......................................................................................................................................................... 61
Printing ......................................................................................................................................................... 64
Toolbars ......................................................................................................................................................... 64
Buttons ......................................................................................................................................................... 64
66
1 How It...................................................................................................................................
Works?
66
2 Showing
...................................................................................................................................
Reports
66
3 Localizing
...................................................................................................................................
Component
68
4 Using...................................................................................................................................
Themes
69
5 Using...................................................................................................................................
Basic Features
72
6 Printing
................................................................................................................................... 73
2003-2013 Stimulsoft
Contents
III
7 Viewing
...................................................................................................................................
Modes
74
8 Using...................................................................................................................................
Parameters
75
9 Viewer
...................................................................................................................................
Settings
75
.......................................................................................................................................................... 75
Actions
Connection .......................................................................................................................................................... 76
.......................................................................................................................................................... 77
Toolbar
.......................................................................................................................................................... 77
Buttons
.......................................................................................................................................................... 78
Exporting Reports
.......................................................................................................................................................... 80
Interface
81
1 How It...................................................................................................................................
Works?
82
2 How to
...................................................................................................................................
Show Report?
82
3 Localizing
...................................................................................................................................
Component
83
4 Using...................................................................................................................................
Themes
84
5 Viewer
...................................................................................................................................
Settings
86
.......................................................................................................................................................... 86
Actions
Connection .......................................................................................................................................................... 87
.......................................................................................................................................................... 87
Dialog Box About
.......................................................................................................................................................... 88
Toolbars
.......................................................................................................................................................... 88
Buttons
.......................................................................................................................................................... 90
Zooming
.......................................................................................................................................................... 90
Exporting
.......................................................................................................................................................... 93
Printing
.......................................................................................................................................................... 93
Interface
94
1 How to
...................................................................................................................................
Show Report?
94
2 Localization
...................................................................................................................................
of StiWebViewerFx Component
95
3 WebViewerFx
...................................................................................................................................
Settings
95
Connection .......................................................................................................................................................... 95
.......................................................................................................................................................... 96
Zooming
96
View er Static..........................................................................................................................................................
Properties
4 Properties
................................................................................................................................... 98
5 Export
...................................................................................................................................
Settings
101
6 Data................................................................................................................................... 103
104
1 How ...................................................................................................................................
to Show Report?
104
2 Dialog
...................................................................................................................................
Options
105
3 User...................................................................................................................................
Interface Settings
105
106
1 How ...................................................................................................................................
It Works?
107
2 How ...................................................................................................................................
to Run Web Reports Designer?
107
2003-2013 Stimulsoft
III
IV
Stimulsoft Reports
3 Loading
...................................................................................................................................
Reports to Web Designer
107
4 Report
...................................................................................................................................
Preview
109
5 Web...................................................................................................................................
Designer Settings
109
Main Menu .......................................................................................................................................................... 109
Zooming .......................................................................................................................................................... 110
.......................................................................................................................................................... 111
View er
6 Changing
...................................................................................................................................
Web Designer Properties from Code
114
7 Web...................................................................................................................................
Reports Designer Localization
115
8 WCF...................................................................................................................................
Server
115
116
1 How ...................................................................................................................................
to Show Report?
116
2 WebViewerSL
...................................................................................................................................
Settings
117
.......................................................................................................................................................... 117
Control Panel
.......................................................................................................................................................... 119
Navigation Panel
Zooming .......................................................................................................................................................... 119
3 Saving
...................................................................................................................................
Mode
120
.......................................................................................................................................................... 121
Export Settings
123
1 Designer
...................................................................................................................................
Properties
123
2 Working
...................................................................................................................................
With Report Code
124
125
1 Showing
...................................................................................................................................
Reports
126
2 Caching
................................................................................................................................... 126
126
RenderMode..........................................................................................................................................................
Property
..........................................................................................................................................................
127
CacheMode Property
..........................................................................................................................................................
127
ServerTimeout Property
3 StiReportResponse
...................................................................................................................................
Class
127
4 Localization
...................................................................................................................................
of StiMobileViewer Component
128
5 Settings
................................................................................................................................... 128
Zooming
Toolbar
.......................................................................................................................................................... 128
.......................................................................................................................................................... 128
6 Properties
................................................................................................................................... 129
7 Setting
...................................................................................................................................
Export
130
8 Defining
...................................................................................................................................
Data
132
133
1 Showing
...................................................................................................................................
Reports
133
2 Custom
...................................................................................................................................
Functions
133
135
1 Installation
................................................................................................................................... 135
2003-2013 Stimulsoft
Contents
2 Creating
...................................................................................................................................
Project
136
3 Creating
...................................................................................................................................
Server
137
4 Creating
...................................................................................................................................
Sample
139
5 Creating
...................................................................................................................................
Sample Page with Report Designer
142
6 Loading,
...................................................................................................................................
Saving and Loading Custom Data
147
156
1 Working
...................................................................................................................................
with Report Code
156
2 Template
...................................................................................................................................
JDBC Coonections
159
160
1 How ...................................................................................................................................
to Show Report?
160
2 Saving
...................................................................................................................................
Report From Code
162
Part XX Exports
163
1 Available
...................................................................................................................................
File Formats
163
2 Export
...................................................................................................................................
Reports From Code
164
..........................................................................................................................................................
165
ExportDocument
Method
.......................................................................................................................................................... 165
Export Formats
.......................................................................................................................................................... 167
Export Service
.......................................................................................................................................................... 168
All Export Services
3 Formats
...................................................................................................................................
with Fixed Page Layout
169
PDF
.......................................................................................................................................................... 169
.........................................................................................................................................................
169
Embedded
Fonts
.........................................................................................................................................................
169
Digital Signature
.........................................................................................................................................
170
Digital Signature from Code
.........................................................................................................................................................
170
Encryption
.........................................................................................................................................
171
Using Parameters
of Encryption from Code
.........................................................................................................................................................
171
Editable Fields
......................................................................................................................................................... 172
Export Settings
......................................................................................................................................................... 173
Static Options
..........................................................................................................................................................
174
XPS
......................................................................................................................................................... 175
Export Settings
......................................................................................................................................................... 175
Static Options
..........................................................................................................................................................
175
Microsoft Pow er Point 2007/2010
.........................................................................................................................................................
176
Export Settings
......................................................................................................................................................... 176
Static Options
4 Web...................................................................................................................................
Documents
176
.......................................................................................................................................................... 176
HTML
......................................................................................................................................................... 177
Export Settings
......................................................................................................................................................... 177
Static Options
..........................................................................................................................................................
178
MHT
.........................................................................................................................................................
178
Export Settings
5 Text...................................................................................................................................
Formats
179
TXT
.......................................................................................................................................................... 179
......................................................................................................................................................... 179
Export Settings
......................................................................................................................................................... 180
Static Options
.......................................................................................................................................................... 180
RTF
2003-2013 Stimulsoft
VI
Stimulsoft Reports
......................................................................................................................................................... 180
Export Settings
......................................................................................................................................................... 181
Static Options
.......................................................................................................................................................... 182
Word 2007/2010
......................................................................................................................................................... 182
Export Settings
......................................................................................................................................................... 182
Static Options
.......................................................................................................................................................... 183
ODT
......................................................................................................................................................... 183
Export Settings
......................................................................................................................................................... 184
Static Options
6 Spreadsheets
................................................................................................................................... 184
.......................................................................................................................................................... 184
Excel
......................................................................................................................................................... 185
Export Settings
......................................................................................................................................................... 185
Static Options
..........................................................................................................................................................
186
Excel 2007/2010
.........................................................................................................................................................
186
Export Settings
......................................................................................................................................................... 186
Static Options
..........................................................................................................................................................
187
ODS
.........................................................................................................................................................
187
Export Settings
......................................................................................................................................................... 188
Static Options
7 Data................................................................................................................................... 188
.......................................................................................................................................................... 188
CSV
Export Settings
......................................................................................................................................................... 188
Static Options
......................................................................................................................................................... 189
.......................................................................................................................................................... 189
DBF
Controlling
.........................................................................................................................................................
Exports
189
Export Settings
......................................................................................................................................................... 190
.......................................................................................................................................................... 191
XML
DIF
Controlling
.........................................................................................................................................................
Exports
191
.......................................................................................................................................................... 192
Export Settings
......................................................................................................................................................... 192
.......................................................................................................................................................... 192
SYLK
Export Settings
......................................................................................................................................................... 193
193
1 Basic
...................................................................................................................................
Approaches
193
194
1 Programming
...................................................................................................................................
Language of Report
194
2 Report
...................................................................................................................................
Code
195
197
1 WinForms
...................................................................................................................................
Report Viewer
197
2 Icons
................................................................................................................................... 197
3 WPF...................................................................................................................................
Reports Designer and Viewer
202
204
1 Assemblies
...................................................................................................................................
in Reports.Net
204
2 Assemblies
...................................................................................................................................
in Reports.Wpf
205
3 Assemblies
...................................................................................................................................
in Reports.Web
207
2003-2013 Stimulsoft
Contents
VII
4 Assemblies
...................................................................................................................................
in Reports Designer.Web
209
5 Assemblies
...................................................................................................................................
in Reports.Silverlight
209
6 Assemblies
...................................................................................................................................
in Reports Designer.Silverlight
211
7 Assemblies
...................................................................................................................................
in Reports.Ultimate
211
8 Assemblies
...................................................................................................................................
in Reports.Fx for Flex
215
9 Assemblies
...................................................................................................................................
in Reports.Fx for PHP
215
10 Assemblies
...................................................................................................................................
in Reports.Fx for Java
216
11 Working
...................................................................................................................................
With Assemblies
216
12 Redistributable
...................................................................................................................................
files in Reports.Net
218
13 Redistributable
...................................................................................................................................
files in Reports.Wpf
218
14 Redistributable
...................................................................................................................................
files in Reports.Web
219
15 Redistributable
...................................................................................................................................
files in Report Designer.Web
219
16 Redistributable
...................................................................................................................................
files in Reports.Silverlight
219
17 Redistributable
...................................................................................................................................
files in Reports Designer.Silverlight
219
18 Redistributable
...................................................................................................................................
files in Reports.Ultimate
220
19 Redistributable
...................................................................................................................................
files in Reports.Fx for Flex
220
20 Redistributable
...................................................................................................................................
files in Reports.Fx for PHP
221
21 Redistributable
...................................................................................................................................
files in Reports.Fx for Java
221
22 Deployment
...................................................................................................................................
in Windows
221
23 Deployment
...................................................................................................................................
in Web
221
24 Deployment
...................................................................................................................................
in Designer.Web
221
25 Deployment
...................................................................................................................................
in Wpf
222
26 Deployment
...................................................................................................................................
in Silverlight
222
27 Deployment
...................................................................................................................................
in Designer.Silverlight
222
28 Deployment
...................................................................................................................................
in PHP
222
29 Deployment
...................................................................................................................................
in Flex
222
30 Deployment
...................................................................................................................................
Reports as Files
222
31 Reports
...................................................................................................................................
as Source Code
223
32 Reports
...................................................................................................................................
as Assemblies
225
33 Standalone
...................................................................................................................................
Reports
226
Index
2003-2013 Stimulsoft
VII
Stimulsoft Reports
Introduction
We are glad to welcome you to the online version of the documentation of Stimulsoft Reports
products. The documentation describes the basics of using the API of our software. Here we will review
how to pass data from code in a report, export reports to various file formats, inherit reports, work
with the components and more:
Welcome to Stimulsoft:
Technical Support
Trial License Limitations
Information in Web and
References
Evaluate Trial Version
Data:
Business Object in Net, Web,
Silverlight
Business Object in WinRT
Showing Reports in
WinForms:
How to Show Report
Dot-Matrix viewer
Reports in Web:
How to Run Web Reports
Designer?
Using Web Viewer
Reports in Java:
Showing Reports in Java
Using Java in Web
Exports:
Available File Formats
Spreadsheets
More...
Report Inheritance:
Basic Approaches
Scripts:
Programming Language of Report
Report Code
2003-2013 Stimulsoft
Introduction
Reports in Silverlight:
Using Web Designer in
Silverlight
Using Silverlight Web Viewer
Deployment:
Working With Assemblies
More...
The first part of the documentation contains the description of work with visual parts of Stimulsoft
products.
1.1
Technical Support
Registered users and users who are evaluating the software may get technical support.
For technical questions, use the Email address: [email protected]
For licensing, subscription, payment questions, use Email address: [email protected]
For other questions, use Email address: [email protected]
If you have problems with our products, you may contact us through our feedback form at http://www.
stimulsoft.com/support.aspx
It is possible to send questions from the standard UI of the report designer. To do this, select the Help
menu -> Support.
If you are a registered user and you contact us for technical support, use the same Email address you
used when you purchased our product. Otherwise, it will be difficult to identify you as a registered user.
This can slow down our response. Please let us know when your Email address changes.
To solve your problem quickly, we need the following information:
- Product name and its version;
- A detailed description of the problem and how to reproduce it;
- Your operating system (98, ME, 2000, XP, Vista, Window 7 etc.), its version, and the localization of
established service packs;
- Version of Microsoft .NET Framework or other development environment and installed service packs;
- A name of your development environment and its version;
- Additional information that can help us solve the problem.
2003-2013 Stimulsoft
1.2
Stimulsoft Reports
1.3
Introduction
You may subscribe to the newsletters on the Home page of our website.
For getting more information about the product in other online resources, please use the search
engines.
Data
2.1
2003-2013 Stimulsoft
Stimulsoft Reports
}
}
}
public Category[] list = null;
public Category[] List
{
get
{
return list;
}
}
}
Now, you should populate the business object. Below is an example of code to populate a Business
Object is with data:
MyObject obj = new MyObject();
obj.list = new MyObject.Category[2];
MyObject.Category c1 = new MyObject.Category();
c1.number = 1;
c1.name = "Cat1";
c1.description = "desc for n1";
MyObject.Category c2 = new MyObject.Category();
c2.number = 2;
c2.name = "Cat2";
c2.description = "desc for n2";
obj.list[0] = c1;
obj.list[1] = c2;
StiReport mainreport = new StiReport();
mainreport.RegBusinessObject("MyObject", obj);
mainreport.Design();
After that, the business object is created, filled with data, registered and passed to the reporting tool.
In order to create a report in the designer using business objects, you should create a data description
in the report dictionary. To do this, select MyObject (created Business Object) in the report dictionary
in and choose New Business Object... from the context menu or the menu New Item. After selecting
this command, the window will open a New Business Object, in which you should specify the Child
Business Object and select lists of data. The picture below shows the dialog New Business Object.
2003-2013 Stimulsoft
Data
After you click Ok, you will be shown the second dialog box form of the New Business Object, where
you can change the detail business object. The picture below shows the second dialog box form of the
New Business Object.
2003-2013 Stimulsoft
Stimulsoft Reports
The field Category displays the category name. When you create a business object the field is not
editable and is purely informative. Also, it may be empty, as in this case.
The field Name is used to specify the name of the business object. This field is always available for
editing, and, in this case, the name List is used.
The field Alias specifies an alias of the business object. This field is always available for editing, and,
in this case, the name List is used.
The button New Column. Pressing it a new data column will be created in the business object. It
should be noted that the data column created this way is a virtual data column and it does not contain
actual data.
The button New Calculated Column is used to insert a new calculated column into the business
object.
The button Delete is used to delete selected data columns. If you select a bookmark Columns, then
all the columns which are in the tab will be deleted.
The button Retrieve Columns is used to get the data column from the business object.
The button Get Columns from Assembly will open the dialog Open Assembly, in which you may
choose an assembly file. After selecting the file, press the button Open and, from this file, data columns
will be extracted, if they are present there.
The panel Columns consists of three fields. In these fields show a list of columns, their properties,
and a description of these properties.
Press the Ok button once the fields are filled and parameters are specified. After that, in the data
dictionary of the report a description of a new business object will be created, which can be used to
create reports. The picture below shows a report built using a business object:
2003-2013 Stimulsoft
Data
Provide the data to business objects from the data source in .NET
Created business objects that are registered and passed to the report generator, but do not contain
the actual data are called a description of business objects. Using the description of the business
object, you can create a report template (define the structure and design the report), and then, before
building, connect the real data and render a report. This is useful if you want to create reports with the
same structure and design, but with different data. Create a structural description of the business
object first. Below is a sample code to create a business object class:
public class MyObject
{
public class Category
{
public int categoryID;
public int CategoryID
{
get
{
return categoryID;
}
}
public string categoryName;
public string CategoryName
{
get
{
return categoryName;
}
}
public string description;
public string Description
{
get
{
return description;
}
}
}
public Category[] list = null;
public Category[] Categories
{
2003-2013 Stimulsoft
Stimulsoft Reports
get
{
return list;
}
}
}
You then need to create a new business object class, register and pass it to the report generator.
Below is a sample code to create and register a new business object:
MyObject.Category obj = new MyObject.Category();
int busobjLevel = 1;
StiReport report = new StiReport();
report.RegBusinessObject("Categories", obj);
report.Dictionary.SynchronizeBusinessObjects(busobjLevel);
report.Design();
Now with help of the created description of the business object, create a report template in the
designer. The picture below shows a report template created with the description of the business
object:
Once a report template is created, you can save it, for example, to the following path D:\\Report.mrt.
Because the description of the business object does not contain the actual data, in order to render a
report, you will get the real data to business objects, in our example we take the data from the
database Northwind. For a start, create a connection to the database in Visual Studio. After that, put
the code to obtain data for the business object. Getting real data for the business object occurs
immediately before the report. Here is the code to obtain data for the business object:
int busobjLevel = 1;
StiReport report = new StiReport();
report.Load("D:\\Report.mrt");
using (NorthwindDataContext context = new NorthwindDataContext())
{
var categories =
2003-2013 Stimulsoft
Data
10
from c in context.Categories
select new { c.CategoryID, c.CategoryName, c.Description };
report.RegBusinessObject("Categories", categories);
report.Show();
}
After that, the report generator will receive the data for the business object from the specified source,
in this case from the database Northwind. Then, the report will be rendered by the existing template.
The picture below shows the rendered report:
2003-2013 Stimulsoft
11
Stimulsoft Reports
int busobjLevel = 1;
StiReport mainreport = new StiReport();
mainreport.RegBusinessObject("MyObject", obj);
mainreport.Dictionary.SynchronizeBusinessObjects(busobjLevel);
StiWebDesigner1.Design(mainreport);
Just as in .NET, in Web you can create a description of the business objects first, then the report
template, and then connect the data source with the real data and render a report. Create a
description of the business object. But previously you have to make the class of the business object
that is identical to the class of business object in .NET. Here is an example of writing a business object:
MyObject.Category obj = new MyObject.Category();
int busobjLevel = 1;
StiReport report = new StiReport();
report.RegBusinessObject("Categories", obj);
report.Dictionary.SynchronizeBusinessObjects(busobjLevel);
StiWebDesigner1.Design(report);
Now with the description created, design a report template identical to .NET. Once a report template is
created, you can save it, for example to the following path D:\\Report.mrt. Since the description of the
business object does not contain the actual data, in order to build a report, you should get the real
data to business objects, in this example, we take the data from the database Northwind. First, create
a connection to the database in Visual Studio. After that, write the code to obtain data for the business
object. Getting real data for the business object occurs immediately before the report. Here is the code
to obtain data for the business object:
int busobjLevel = 1;
StiReport report = new StiReport();
report.Load("D:\\Report.mrt");
using (NorthwindDataContext context = new NorthwindDataContext())
{
var categories =
from c in context.Categories
select new { c.CategoryID, c.CategoryName, c.Description };
report.RegBusinessObject("Categories", categories);
StiWebViewer1.Report = report;
}
2003-2013 Stimulsoft
Data
12
sample code:
SaveFileDialog sf = new SaveFileDialog();
sf.Filter = "Files report (*.mrt)|*.mrt";
if (sf.ShowDialog() == true)
{
Stream file = sf.OpenFile();
report.Load(file);
}
2.2
2003-2013 Stimulsoft
13
Stimulsoft Reports
if (storageFile != null)
{
StiReport report = new StiReport();
report.RegBusinessObject("Categories", "Categories", GetData());
report.Dictionary.SynchronizeBusinessObjects(3);
await report.SaveAsync(storageFile);
}
Next, consider creating a report template with the description of the business objects, filling them with
real data and reporting.
Creating a report template with a description of the business object
To do this, open a saved report with the structure of the dictionary or open the dictionary data in the
report designer. Next, using the description, you should create a report template. For example,
dragging the business object to the page. When dragging the dialogue form Data will be invoked,
which determines the field references of the business object, the basis of the report - Data Band or
Table, as well as to add a Header Band and Footer Band to the report template. You should also edit
report components. The picture below shows the created report template:
The picture above shows that the report template is created. Since it was created with a description of
the business object that does not contain the actual data, the report can not be rendered. For
rendering a report, a business object should be filled with real data. This can be done manually by
specifying values for the fields, or to connect the data source from which the data will be delivered.
Created report template should be saved, for example, in the folder "My Documents" with the name
Report.mrt.
Filling the business object with the real data
Filling the business object in this example, will be done from the installed database. First, we need to
create a connection to this database in Visual Studio. After this, you should specify the filling code of
the business object. Filling the actual business object data directly before the report. Here is the code
to fill the business object:
Xaml:
<Page>
<viewerRT:StiViewerControl x:Name="viewerControl" />
</Page>
C#:
2003-2013 Stimulsoft
Data
14
After that, the report generator fills the business object with data from the specified data source, in this
case from the database Northwind, the table Categories. Then, the report will be rendered by the
existing template. The picture below shows the rendered report:
2003-2013 Stimulsoft
15
3.1
Stimulsoft Reports
VB.NET
Dim Report As StiReport = New StiReport()
Report.Load("report.mrt")
Report.Show()
If the report was not rendered before showing, the Show method will render a report using the
Render method.
3.2
2003-2013 Stimulsoft
16
3.2.1
As can be seen on the picture above, the Auto Refresh property is enabled. This means that the
AutoRefresh static property of the Dot-Matrix viewer is set to true. If the AutoRefresh static property
is set to false, then the AutoRefresh property in the Dot-Matrix viewer is disabled. Add the following
code into the project code:
StiOptions.Viewer.DotMatrix.AutoRefresh = false;
Thus, the AutoRefresh property will be disabled. The picture below shows the Dot-Matrix viewer
dialog box with disabled auto refresh function:
2003-2013 Stimulsoft
17
Stimulsoft Reports
3.2.2
Normal text <#b> Bold text <#/b><#i> Italic text <#/i> Again normal text
Also commands of selecting bold, italic or underlined text are automatically inserted depending on the
style of the text box font. When printing to matrix printer and exporting to text format these commands
are changed on appropriate escape sequences.
The StiEscapeCodesCollection is used for this process. It is inherited from the Hashtable class. This is
a collection of "key-value" pairs where the key is the command and value is the escape-sequence. For
different types of printers different collections with different set of command can be defined.
Collections are stored in the StiOptions.Export.Txt.EscapeCodesCollectionList static variable. By
default, the following collections will be created: "None", "EpsonFX", "Oki ML92/93". The "None"
collection is empty and used to output the text without escape codes.
Command/Collection
EpsonFX
Oki ML92/93
ESC E
ESC T
2003-2013 Stimulsoft
Command/Collection
EpsonFX
Oki ML92/93
/b
ESC F
ESC I
ESC 4
/i
ESC 5
ESC -1
ESC H
/u
ESC -0
ESC D
sup
ESC S0
ESC J
/sup
ESC T
ESC K
sub
ESC S1
ESC L
/sub
ESC T
ESC M
condensed
0x0F
0x1d
/condensed
0x12
0x1e
elite
ESC M
0x1c
pica
ESC P
0x1e
doublewidth
ESC W1
0x1f
/doublewidth
ESC W0
0x1e
18
It is possible to add new collections of change the existing ones. The selection of the required
collection is done by the name. If the collection with the name is not found then the "None" collection is
used. The collection name can be selected from the DotMatrixViewer settings and passed as an option
to the exporting and printing methods.
4.1
2003-2013 Stimulsoft
19
Stimulsoft Reports
report.Load("report.mrt");
report.ShowWithWpf();
VB.NET
Dim Report As StiReport = New StiReport()
Report.Load("report.mrt")
Report.ShowWithWpf()
If the report was not rendered before showing, the ShowWithWpf method will render a report using
the RenderWithWpf method.
4.2
2003-2013 Stimulsoft
4.2.1
20
As can be seen on the picture above, the AutoRefresh property is enabled. This means that the
AutoRefresh static property of the Dot-matrix viewer is set to true. If the AutoRefresh static property is
set to false, then the AutoRefresh property in the Dot-matrix viewer is disabled. Add the following code
into the project code:
StiOptions.Viewer.DotMatrix.AutoRefresh = false;
Thus, the AutoRefresh property will be disabled. The picture below shows the Dot-matrix viewer
dialog box with disabled auto refresh function:
2003-2013 Stimulsoft
21
Stimulsoft Reports
4.2.2
Also commands of selecting bold, italic or underlined text are automatically inserted depending on the
style of the text box font. When printing to matrix printer and exporting to text format these commands
are changed on appropriate escape sequences.
The StiEscapeCodesCollection is used for this process. It is inherited from the Hashtable class. This is
a collection of "key-value" pairs where the key is the command and value is the escape-sequence. For
different types of printers different collections with different set of command can be defined.
Collections are stored in the StiOptions.Export.Txt.EscapeCodesCollectionList static variable. By
default, the following collections will be created: "None", "EpsonFX", "Oki ML92/93". The "None"
collection is empty and used to output the text without escape codes.
Command/Collection
EpsonFX
Oki ML92/93
ESC E
ESC T
/b
ESC F
ESC I
2003-2013 Stimulsoft
Command/Collection
EpsonFX
ESC 4
/i
ESC 5
ESC -1
ESC H
/u
ESC -0
ESC D
sup
ESC S0
ESC J
/sup
ESC T
ESC K
sub
ESC S1
ESC L
/sub
ESC T
ESC M
condensed
0x0F
0x1d
/condensed
0x12
0x1e
elite
ESC M
0x1c
pica
ESC P
0x1e
doublewidth
ESC W1
0x1f
/doublewidth
ESC W0
0x1e
22
Oki ML92/93
It is possible to add new collections of change the existing ones. The selection of the required
collection is done by the name. If the collection with the name is not found then the "None" collection is
used. The collection name can be selected from the DotMatrixViewer settings and passed as an option
to the exporting and printing methods.
2003-2013 Stimulsoft
23
5.1
Stimulsoft Reports
How It Works?
To run the web reports designer, it is required to put theStiWebDesigner component on the ASP.NET
page and call the Design method of this component. When running the Web reports designer the
following actions occur:
The .NET component reads to the memory the client Flash application from resources and runs it.
When it is loaded, the client side, in the AJAX mode, requests from the server side all necessary
settings and the report file. The server side passes all this.
When saving a report in the preview mode, the client side sends the report file as XML in the AJAX
mode and the server side makes the premature processing of the report, and either sends it for saving
or compile it in the window of a browser.
5.2
C#:
protected void Button1_Click(object sender, EventArgs e)
{
StiWebDesigner1.Design();
}
VB.NET:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
EventArgs)
StiWebDesigner1.Design()
End Sub
For loading a report in the Web designer, the method of calling can be slightly modified:
C#:
protected void Button1_Click(object sender, EventArgs e)
{
StiReport report = new StiReport();
report.Load("D:\\SimpleList.mrt");
StiWebDesigner1.Design(report);
}
VB.NET:
2003-2013 Stimulsoft
24
It requires a bit more complicated code to call the reports designer automatically when loading a
page. It is necessary to exclude service messages which are sent by the client part of the designer to
the server part:
C#:
protected void Page_Load(object sender, EventArgs e)
{
if (Page != null)
{
string keyValue = Page.Request.QueryString.Get(
"stimulsoft_webdesigner");
if (!IsPostBack && keyValue == null)
{
StiReport report = new StiReport();
report.Load("D:\\SimpleList.mrt");
StiWebDesigner1.Design(report);
}
}
}
VB.NET:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Not Page Is Nothing Then
String keyValue = Page.Request.QueryString.Get(
"stimulsoft_webdesigner")
If Not IsPostBack And keyValue Is Nothing Then
Dim report As StiReport = New StiReport()
report.Load("D:\\SimpleList.mrt")
StiWebDesigner1.Design(report)
End If
End If
End Sub
5.3
2003-2013 Stimulsoft
25
Stimulsoft Reports
or, as a way, the previously loaded report is assigned to the designer. In this case designer loading is
done with this report. See the code below:
protected void Button1_Click(object sender, EventArgs e)
{
StiReport report = new StiReport();
report.Load("D:\\SimpleList.mrt");
StiWebDesigner1.Report = report;
StiWebDesigner1.Design();
}
Loading a report after loading the designer is done using the GetReport event. After adding the
handler to this event, it will occur each time when a report is required for the designer. In other words,
after loading the Web designer requests a report from the server and, if the handler is added to the
GetReport event, then in this event a report can be assigned to the designer. See the code below how
to use the GetReport event:
protected void StiWebDesigner1_GetReport(object sender, StiWebDesigner.
StiGetReportEventArgs e)
{
StiReport report = new StiReport();
report.Load("D:\\SimpleList.mrt");
e.Report = report;
}
If the designer is set to the Visual mode, then the report should be loaded with way specified
below:
protected void Button1_Click(object sender, EventArgs e)
{
StiReport report = new StiReport();
report.Load("D:\\SimpleList.mrt");
2003-2013 Stimulsoft
26
StiWebDesigner1.Report = report;
}
5.4
Report Preview
The preview function of the edited report, in the Web designer, has two modes: HTML (preview as
HTML file) and PDF (preview as PDF file). After selecting one of two modes, a report will be shown is
the browser window. If, when report rendering, the errors occur, then alert messages will be shown in
the separate browser window. To preview a report in the web designer window can be done by
switching the Preview tab in the designer. To preview the report data are required. By default, data are
taken from the Dictionary of the edited report. If necessary, they can be overridden. There is a sample
code below using what data can be overridden:
C#:
protected void StiWebDesigner1_GetPreviewDataSet(object sender,
StiWebDesigner.StiPreviewDataSetEventArgs e)
{
DataSet data = new DataSet();
data.ReadXml("D:\\Demo.xml");
data.ReadXmlSchema("D:\\Demo.xsd");
e.PreviewDataSet = data;
}
VB.NET:
Protected Sub StiWebDesigner1_GetPreviewDataSet(ByVal sender As Object,
ByVal e As StiWebDesigner.StiPreviewDataSetEventArgs)
Dim data As DataSet = New DataSet()
data.ReadXml("D:\\Demo.xml")
data.ReadXmlSchema("D:\\Demo.xsd")
e.PreviewDataSet = data
End Sub
As seen from code, data are taken from XML and XSD files. The same way exists for other data
sources. If any connections to the database are specified in the report, they have a higher priority than
the data specified in the GetPreviewDataSet event. In order specified data be applied when rendering
the report, you should clear the list of connections:
protected void StiWebDesigner1_GetPreviewDataSet(object sender,
StiWebDesigner.StiPreviewDataSetEventArgs e)
{
e.Report.Dictionary.Databases.Clear();
DataSet data = new DataSet();
data.ReadXml("D:\\Demo.xml");
2003-2013 Stimulsoft
27
Stimulsoft Reports
data.ReadXmlSchema("D:\\Demo.xsd");
e.PreviewDataSet = data;
}
5.5
Now, before report rendering, the name will be changed from the existing one to Report 2010. Thus,
using the ProcessReportBeforeRender event, the user can change custom options before rendering.
5.6
Saving Reports
Two events are used for the processing of a saved report in the Web-designer. These are SaveReport
and SaveReportAs. The SaveReport event occurs when you click on the Save Report button or when
you click on the Save Report item of the main menu in the designer. The SaveReportAs event occurs
when you select the Save As item of the main menu in the designer. When the user is not signed to this
event, then, by default, a built-in Web-designer dialog box to save the report is called. If the user is
assigned to this event, then the dialog box will not appear but the event will appear, i.e. saving is done
by the server. See the code below:
C#:
protected void StiWebDesigner1_SaveReport(object sender,
StiWebDesigner.StiSaveReportEventArgs e)
{
StiReport report = e.Report;
}
VB.NET:
Protected Sub StiWebDesigner1_SaveReport(ByVal sender As Object, ByVal
e As StiWebDesigner.StiSaveReportEventArgs)
2003-2013 Stimulsoft
28
After that, the ways and place to save the report are identified by the user. For example, the report can
be saved to a string in the database. Below is the code to save a report to the string:
C#:
protected void StiWebDesigner1_SaveReport(object sender,
StiWebDesigner.StiSaveReportEventArgs e)
{
StiReport report = e.Report;
string str = report.SaveToString();
}
VB.NET:
Protected Sub StiWebDesigner1_SaveReport(ByVal sender As Object, ByVal
e As StiWebDesigner.StiSaveReportEventArgs)
Dim report As StiReport = e.Report
Dim str As String = report.SaveToString()
End Sub
Subscription to the SaveReportAs event is made by analogy with the SaveReport event. In the event of
saving a report you can use the ErrorCode property of the event argument. The ErrorCode property
can take numeric values. By default, this property is set to -1. This means that, when saving a report, the
report event occurs, but nothing will be output in the Web-designer. If this property is set to 0, then the
user will be notified about that the report is saved successfully. The picture below shows a notification
window which indicates successful report saving:
If the ErrorCode property will be greater than 0, then the error message is displayed with its source
code where the error is the value of the ErrorCode. The picture below shows a window with the error
code 1:
2003-2013 Stimulsoft
29
Stimulsoft Reports
Report saving occurs in the background mode, i.e. visually it will not be displayed. If you need to
visually manage the process of saving the report, you may change the SaveMode property of the
StiWebDesigner component on one of two values: Visible or NewWindow:
<cc1:StiWebDesigner ID="StiWebDesigner1" runat="server" OnSaveReport
="StiWebDesigner1_SaveReport" SaveMode="NewWindow" />
If the SaveMode property is set to Visible, the process of saving the report will be displayed in the
current browser window. If the property is set to NewWindow, then the process of saving the report
will be displayed in a new browser window. By default, this property is set to Hidden, i.e. the process of
saving the report is not displayed.
5.7
5.7.1
Connection
The static properties described below belong to the StiWebDesignerOptions.Connection group and
responsible for option of connection the client and server sides:
Name
Description
ClientRequestTimeout
property sets time (in seconds) that the client part will wait the response
from the server side. The default value is 10 seconds.
ClientRepeatCount
property sets the number of repeats of requests of the server side to the
client side, when getting errors of obtaining data. The default value is 2
repeats.
RelativeUrls
property allows using the relative Url. If the RelativeUrls is set to false,
then the absolute Url is used. If the RelativeUrls is set to true, then the
relative Url is used. By default, the value is set to false. A sample of the
absolute and relative Urls is shown below:
http://localhost:4444/WebDesignerDemo/WebDesigner.aspx
is an
2003-2013 Stimulsoft
30
5.7.2
Main Menu
The main menu of the Web designer can be setup according to user's requirements. This group of
static properties StiWebDesignerOptions.Menu allows enabling/disabling main menu or submenu
items.
Name
Description
NewEnabled
NewReport
NewReportWithWizar
d
NewPage
OpenReport
SaveReport
2003-2013 Stimulsoft
31
5.7.3
Stimulsoft Reports
SaveAs
DeletePage
Preview
PreviewAsPdf
PreviewAsHtml
Description
PageWidth
Value sets zoom by Page Width. So the width of the report template
matches the width of the window of the web designer.
PageHeight
Value sets zoom by Page Height. So the height of the report template
matches the height of the window of the web designer.
OnePage
Value sets zoom by One Page. So the entire page of the report template
fits in the window of the web designer.
Zoom25,
Zoom75,
Zoom50, Values set zoom level of the report template which is 25%, 50%, 75%,
Zoom100, 100%, 150%, 200%.
2003-2013 Stimulsoft
32
Zoom150, Zoom200
5.7.4
Description
ShowZoom
ShowPrintButton
ShowOpenButton
ShowSaveButton
ShowPageDeleteButto
n
ShowPageSizeButton
ShowBookmarksButto
Property
2003-2013 Stimulsoft
is
used
to
show/hide
the
Bookmarks
button.
If
the
33
Stimulsoft Reports
ShowEditButton
ShowFirstPageButton
ShowPreviousPageBut
ton
ShowLastPageButton
2003-2013 Stimulsoft
ShowPageViewModeC
ontinuousButton
34
the
the
the
the
5.7.5
Description
ModifyDictionary
ModifyConnections
ModifyDataSources
ModifyVariables
ModifyTemplate
AllowScale
CodeTabVisible
2003-2013 Stimulsoft
35
Stimulsoft Reports
property is set to true, then the code tab will be shown. If the
CodeTabVisible property is set to false, then the code tab will be hidden.
By default this property is set to true.
5.8
DictionaryTabVisible
ExitButtonVisible
Property is used to show/hide the Exit button in the main menu. If the
ExitButtonVisible property is set to true, then the button tab will be
shown. If the ExitButtonVisible property is set to false, then the button
tab will be hidden. By default this property is set to true.
Description
BrowserTitle
property is used to change titles of a browser. This property may get string
values. By default, the title of a browser is Report Alias, and if it is absent, it is a
Report Name.
SaveMode
If you need to show the process of saving a report, you need to set the
SaveMode property of the StiWebDesigner component to one of the following
values: Visible or NewWindow. If the SaveMode property is set to Visible,
then process will be displayed in the current window of the designer. If the
SaveMode property is set to NewWindow, then the saving process will be
shown in a new window of the browser. By defauly this property is set to Hidden,
the process of saving is not shown.
SaveAsMode
The difference of this property is that, it works when the SaveReportAs event
occurs, and the SaveMode property when the SaveReport event occurs.
DataEncryption
DataCompressio
n
UseCache
property allows using caching on the server when loading a report. If the
UseCache property is set to true, then caching is used when loading a report, i.
e. a report is loaded to the Web designer from the server cache. If the
UseCache property is set to false, then caching is not used when loading a
report. In this case for loading the report in the Web designer the GetReport
2003-2013 Stimulsoft
36
property is used to define the time of a report in the report cache. By default,
this property is set to "00:10:00", this means that the report is stored 10
minutes in the server cache and then it is removed.
ExitUrl
property is used to assign Url, to what user will be redirected when closing the
Web designer via clicking the Exit button of the main menu. By default, a user
will be redirected on a page from what the Web designer is run.
ShowWizardOnSt property is used to show the report rendering wizard window when running the
artup
Web designer. If the ShowWizardOnStartup property is set to false, then,
when running the Web designer, the report rendering wizard window will not be
shown. If the ShowWizardOnStartup property is set to true, then, when running
the Web designer, the report rendering wizard window will be shown. By
default, this property is set to false.
AppCacheDirecto property is used to define the path to the directory on the server, in what,
ry
caching files of the Flash-application will occur. For this, you should set full
access of the ASP.NET application to this directory.
ShowSelectLangu Shows/hides the button to invoke the menu of selecting the localization. If this
age
property is set to true, the button is displayed. If the property is set to false, the
menu button is hidden. By default, this property is set to true.
5.9
Now, when running the Web designer, it will be localized in English. For example, we need to change
the browser title. By default, the browser title is the value of the Report Alias property. If the value is
not set then the Report Name is taken. To change the browser title it is necessary to add the code
below to the event:
protected void StiWebDesignerSL1_PreInit(object sender,
StiWebDesignerSL.StiPreInitEventArgs e)
{
e.WebDesignerSL.BrowserTitle = "Stimulsoft";
2003-2013 Stimulsoft
37
Stimulsoft Reports
}
Now, when running the Web designer, Stimulsoft word will be shown as a report title.
runat="server"
Also, it is possible to specify which language can be used right after the web reports designer (default
localization). The following code shows how to do this. (it is necessary to specify the .xml file in the
Localization property):
<cc1:StiWebDesigner ID="StiWebDesigner1" runat="server" Localization="ru"
/>
If the designer is in visual mode, then the report should be loaded with the following method:
protected void Button1_Click(object sender, EventArgs e)
{
StiReport report = new StiReport();
report.Load("D:\\SimpleList.mrt");
StiWebDesigner1.Report = report;
}
If to call the Design () method in the visual mode of the designer, then loaded report is displayed on
2003-2013 Stimulsoft
38
6.1
Caching
The StiWebViewer component can output reports in two modes: 1. Using the caching and 2. Without
caching. If the cashing is not used then it is necessary, when every page refreshing, to get data from a
report and render a report again. When using caching the rendered report is saved in cache on the
server. The next time when the page is refreshed, the previously rendered report is loaded from cache
and its re-rendering is not required. It is important to remember that every report saved in cache takes
the server memory and, if there are a lot of queries to reports, it can be a critical factor. Therefore, one
should choose choose either low requirements to the memory but high requirements to performance
or high requirements to the memory but low requirements to speed. Caching should not be used if the
end user needs a report with actual data when every refreshing. The caching process can be controlled
using the RenderMode, CacheMode, and ServerTimeOut properties.
If the caching of a report is not used then the report that was rendered using the last data when page
refreshing will be printed but not the report that is shown on the current moment. If it is necessary to
get the exact copy of a report form the browser, then it is necessary to use caching.
Notice. It should be borne in mind that if the report caching is not used, then not the report that is
shown currently will be printed, but one that will be rendered using the latest data when refreshing a
page. If it is important to get an exact copy of the report from the browser, you should use caching.
6.1.1
RenderMode Property
The RenderMode property indicates how and when a report should be rendered. All modes of the
StiWebViewer component can be divided in two categories: using the caching of a rendered report,
and without using caching of the rendered report. The modes without caching
Standard
In this mode, the report should be re-rendered every time when the page is refreshed. In addition, this
mode does not use Ajax to display the controls of the StiWebViewer and any report refresh with help
of controls of the StiWebViewer component leads to the page refresh on what the report is output.
RenderOnlyCurrentPage
Very interesting mode of the report output. In this mode, the report is rendered only to the page that
is currently displayed in the StiWebViewer component. For example, if the report consists of 100
pages (this is a big report to be output in the web), and the current page is the page number 5, the
report will be rendered only up to the page number 5. The sever memory is saved in this mode.
2003-2013 Stimulsoft
39
Stimulsoft Reports
Ajax
This mode uses Ajax to output a report and to update the content of the StiWebViewer component.
For example, if a user goes to the next page of a report then not the whole page of the browser on
what the StiWebViewer component is placed will be refreshed but only the next page of a report will
be sent to the browser using the post-back query. This increases the convenience of working with the
StiWebViewer component.
Modes with caching are UseCache and AjaxWithCache.
UseCache
With each refresh in the StiMobileViewer component page reloading from the server occurs, but the
report is not re-rendered but each time is loaded from the cache.
AjaxWithCache
This mode as well as the Ajax mode uses the Ajax technology to output a report and also is used for
refreshing operations of the StiWebViewer component. However, unlike the Ajax mode, this
AjaxWithCache mode does not re-render the report after each information request on the server. The
report that was earlier saved in cache is used.
6.1.2
CacheMode Property
The CacheMode property indicates what cache should be used to store reports, images, and service
information. There are two ways:
Page
A page cache will be used.
Session
A session cache will be used.
6.1.3
ServerTimeout Property
The ServerTimeout property indicates the amount of time on what it is necessary to save a report,
pictures of a report, or other data in the cache. Do not use too much time or too little time. If the time
is too large, then the used cache will be overflowed and will be automatically cleared by the server. As
a result, the report (or images of a report) will not be cached, and incorrect result of the report output
in the StiWebViewer component will occur. If the time is too small, then by the time of request to the
cache, there some necessary data may not be found. It is recommended to set the time equal to 10
minutes. But the exact time can be found experimentally, considering the parameters of the server,
users activity, etc.
6.2
Printing Reports
It is difficult to print a report from the browser. Stimulsoft Reports has three methods of printing:
Converting a report to the PDF file and passing it to the end-user for printing.
2003-2013 Stimulsoft
40
6.3
StiReportResponse Class
A report can be shown without using the StiWebViewer component. The special Stimulsoft.Report.
Web.StiReportResponse class is used in this case. This class is a set of methods for saving a rendered
report in different formats to the stream of a page. It is possible to assign a lot of input parameters
which allows controlling the saving format of a report. For example, the following code can be used to
save a report to the PDF format to the stream of a page:
StiReport report = new StiReport();
report.Load("MyReport.mrt");
report.Render(false);
Stimulsoft.Report.Web.StiReportResponse.ResponseAsPdf(this, report);
In this code the report will be loaded first. Then this report will be rendered. Then the result of the
report rendering will be saved to the stream of a page. The following code saves a report to the Excel
2007 format.
StiReport report = new StiReport();
report.Load("MyReport.mrt");
report.Render(false);
Stimulsoft.Report.Web.StiReportResponse.ResponseAsExcel2007(this,
report);
6.4
2003-2013 Stimulsoft
41
6.5
Stimulsoft Reports
6.6
7.1
How It Works?
To run the web reports designer, it is required to put the StiMvcDesigner component on the ASP.NET
page, set necessary properties and define required actions in the view controller. When running the
Web reports designer the following actions occur:
The .NET component reads to the memory the client Flash application from resources and runs it.
When it is loaded, the client side requests a report that should be returned by action set and
defined in the controller settings.
When exporting a report, the client side calls an action, which also must return the specific response.
2003-2013 Stimulsoft
7.2
42
Razor:
<head runat="server">
@Html.Stimulsoft().RenderMvcDesignerScripts()
</head>
To view the report you should add the StiMvcDesigner component to an ASP.NET page, and set it the
necessary properties, and in the view controller, to determine the necessary steps:
ASPX:
<%= Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
ActionGetReportTemplate = "GetReportTemplate",
Width = Unit.Percentage(100),
Height = Unit.Pixel(700)
})%>
Razor:
@Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
ActionGetReportTemplate = "GetReportTemplate",
Width = Unit.Percentage(100),
Height = Unit.Pixel(700)
})
Controller:
public ActionResult GetReportTemplate()
{
StiReport report = new StiReport();
report.Load(Server.MapPath("~/Content/SimpleList.mrt"));
return StiMvcDesigner.GetReportTemplateResult(report);
}
2003-2013 Stimulsoft
43
7.3
Stimulsoft Reports
Controller:
public ActionResult GetReportTemplate()
{
StiReport report = new StiReportCompiledClass();
return StiMvcDesigner.GetReportTemplateResult(report);
}
Also, the report template can be downloaded from the main menu of the web designer, selecting the
item Open Report. After selecting this menu item a dialog box will appear. In this dialog box you can
specify the report template for loading.
7.4
Previewing Reports
The preview function of the edited report, in the Web designer, has two modes: HTML, PDF, XPS.
After selecting one of the viewing modes of the report, it will be rendered and displayed in the
browser window. If any errors occur when rendering a report, the notification to the user will be
displayed in a separate browser window.
To preview a report in the above formats, you must define a special action, which has the
recommended name ExportReport:
ASPX:
<%= Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
ActionExportReport = "ExportReport"
})%>
Razor:
2003-2013 Stimulsoft
44
@Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
ActionExportReport = "ExportReport"
})
The data, sent to the controller, will be a report and information about what type of export is
requested by the designer and what preview mode is set. The report can be obtained by using the
following code:
StiReport report = StiMvcDesigner.GetReportObject(this.Request);
The specified action should return the report to the client side, prepared in the selected format:
Controller:
public FileResult ExportReport()
{
StiReport report = StiMvcDesigner.GetReportObject(this.Request);
return StiMvcDesigner.ExportReportResult(this.Request, report);
}
If you do not need to carry out any manipulation with the report sent for preview, then you can use a
simplified action code:
Controller:
public FileResult ExportReport()
{
return StiMvcDesigner.ExportReportResult(this.Request);
}
If the report requires data other than those specified in the report template, you can use the following
solution:
Controller:
public FileResult ExportReport()
{
DataSet data = new DataSet("Demo");
data.ReadXml(Server.MapPath("~/Content/Demo.xml"));
StiReport report = StiMvcDesigner.GetReportObject(this.Request);
report.Dictionary.Databases.Clear();
report.RegData(data);
return StiMvcDesigner.ExportReportResult(this.Request, report);
}
2003-2013 Stimulsoft
45
Stimulsoft Reports
Also, previewing report can be done in the web designer by clicking the tab Preview on the panel of
pages list. To preview the rendered report you should to define the specific action that has
recommended name GetReportSnapshot:
ASPX:
<%= Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
ActionGetReportSnapshot = "GetReportSnapshot"
})%>
Razor:
Razor:
@Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
ActionGetReportSnapshot = "GetReportSnapshot"
})
As in the previous form of the preview, the data sent to the data controller will be in the report. This
action should return the report to the client side, prepared in a special format. To do this, use the
following code:
Controller:
public ActionResult GetReportSnapshot()
{
return StiMvcDesigner.GetReportSnapshotResult(this.Request);
}
If the report requires data other than those specified in the report template, you can use the same
solution as in the previous form of the preview:
Controller:
public ActionResult GetReportSnapshot()
{
DataSet data = new DataSet("Demo");
data.ReadXml(Server.MapPath("~/Content/Demo.xml"));
StiReport report = StiMvcDesign.GetReportObject(this.Request);
report.Dictionary.Databases.Clear();
report.RegData(data);
return StiMvcDesigner.GetReportSnapshotResult(this.Request, report);
}
2003-2013 Stimulsoft
7.5
46
To export a report to the selected format, you must define a special action, which has the
recommended name ExportReport:
2003-2013 Stimulsoft
47
Stimulsoft Reports
ASPX:
<%= Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
ActionExportReport = "ExportReport"
})%>
Razor:
@Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
ActionExportReport = "ExportReport"
})
The data, sent to the controller, will be a report and information about what type of export is
requested by the designer and what the settings are set. The report can be obtained by using the
following code:
StiReport report = StiMvcDesigner.GetReportObject(this.Request);
If you do not need to carry out any manipulation with the report sent for exporting, you can use a
simplified action code:
Controller:
public FileResult ExportReport()
{
return StiMvcDesigner.ExportReportResult(this.Request);
}
If the report requires data other than those specified in the report template, you can use the following
solution:
Controller:
public FileResult ExportReport()
{
2003-2013 Stimulsoft
48
7.6
Razor:
@Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
ActionGetReportCode = "GetReportCode"
})
The report, edited at the current time, will be placed in the data transmitted to the controller. The
report code can be obtained using the following method:
Controller:
public ActionResult GetReportCode()
{
return StiMvcDesigner.GetReportCode(this.Request);
}
This action will prepare a C#/VB.NET code in the required format and send it to the client for
displaying.
7.7
2003-2013 Stimulsoft
49
Stimulsoft Reports
report, for example, Report Name. To do this set the value of the ReportName property in the preview
or export. The value of this property and will be the name of the report:
Controller:
public FileResult ExportReport()
{
StiReport report = StiMvcDesigner.GetReportObject(this.Request);
report.ReportName = "Employees";
return StiMvcDesigner.ExportReportResult(this.Request, report);
}
Now, before you render the report the name will change on Employees. Thus, using this method, you
can change parameters of the report before it is rendered.
7.8
Saving Reports
For processing the saved report in the web designer two specific actions are used. They have
recommended names, respectively, SaveReportTemplate and SaveReportTemplateAs. The action
SaveReportTemplate is invoked when clicking the button Save Report on the panel Quick Access or
selecting the item Save Report of the main menu in the designer. The action SaveReportTemplateAs is
invoked when selecting the item Save As in the main menu of the designer. If the second action is not
specified in the settings of a web designer, then, by default, the built-in dialog box of the web designer
to save the report locally is invoked. If the action is specified, the dialog is not invoked. Below is an
example of the code of the report saving action SaveReportTemplate (the code of the action
SaveReportTemplateAs will be the same):
Controller:
public ActionResult SaveReportTemplate()
{
StiReport report = StiMvcDesigner.GetReportObject(this.Request);
string packedReport = report.SavePackedReportToString();
// ...
// Here the save report code
// ...
return StiMvcDesigner.SaveReportResult(false);
}
After that, the options and where to save the report are identified by the user. For example, the report
can be saved on the server in a database or a file. This action must return a response from the server
to save the report. The response may be of three types: Boolean, Integer or String. In the first case, if
the action returns false, after saving the report, no dialog boxes will be displayed in the web designer.
If the action returns true, then, when saving the web designer, a dialog box saying successful report
saving will appear:
2003-2013 Stimulsoft
50
If a string value is set, then the dialog box is output indicating that there is an error with report saving
and the error text will be output:
If to set an integer value, the user is shown an error message to save a report and an error code
where the error code is the specified value. The picture below shows an example of an error message
with code 1:
Saving a report is carried out in the background, i.e. it will not be displayed visually. If you need some
way to visually control the process of report saving, change the value of the
SaveReportTemplateMode property of the web designer to one of three values: Hidden, Visible or
NewWindow:
ASPX:
<%= Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
ActionGetReportTemplate = "GetReportTemplate",
SaveReportTemplateMode = StiMvcDesignerOptions.SaveMode.
Visible
})%>
Razor:
@Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
2003-2013 Stimulsoft
51
Stimulsoft Reports
ActionGetReportTemplate = "GetReportTemplate",
SaveReportTemplateMode = StiMvcDesignerOptions.SaveMode.
Visible
})
If the SaveReportTemplateMode property is set to Visible, then the action of report saving will be
called in the current browser window in the visible mode. If the property is set to to NewWindow, then
the action of report saving will be called in a new browser window. By default, this property is set to
Hidden, this means that the action of report saving is called in the AJAX mode and will not appear in
the browser window. The same values and behavior can be applied for the
SaveReportTemplateAsMode property.
If necessary which report is saved the previously loaded or a new one that is created in the Webdesigner, you can use the following method:
Controller:
public ActionResult SaveReportTemplate()
{
StiReport report = StiMvcDesigner.GetReportObject(this.Request);
string packedReport = report.SavePackedReportToString();
string isNewReport = StiMvcDesigner.GetNewReportFlag(this.Request);
if (isNewReport)
{
// Here the save new report code
}
else
{
// Here the save edited report code
}
return StiMvcDesigner.SaveReportResult(false);
}
7.9
2003-2013 Stimulsoft
52
Razor:
@Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
ActionGetLocalization = "GetLocalization"
})
Controller:
public ActionResult GetLocalization()
{
string path = Server.MapPath("~/Content/Localization/en.xml");
return StiMvcDesigner.GetLocalizationResult(path);
}
The interface provides a web designer possibility to select localization from the available list. In order
to download the desired localization file, you can use the following method for obtaining the name of
the localization selected in the web designer:
Controller:
public ActionResult GetLocalization()
{
string path = Server.MapPath("~/Content/Localization/");
string name = StiMvcDesigner.GetLocalizationName(this.Request);
return StiMvcDesigner.GetLocalizationResult(path + name);
}
Razor:
@Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
2003-2013 Stimulsoft
53
Stimulsoft Reports
ActionDataProcessing = "DataProcessing",
ActionGoogleDocs = "GoogleDocs",
ActionExitDesigner = "ExitDesigner"
})
DataProcessing
The action DataProcessing is used to process the data on the server side requested with the web
designer. These data are processing requests, related to testing of the database connection, getting
data columns, getting images for certain report components, etc. If this action is not specified, then the
above functionality is not available. This action is defined in the view controller as follows:
Controller:
public ActionResult DataProcessing()
{
return StiMvcDesigner.DataProcessingResult(this.Request);
}
GoogleDocs
With help of the action GoogleDocs you can handle requests of the web designer for working with
cloud storage Google Docs, where you can save report templates. If this action is not specified, then
this functionality of working with Google Docs will not be available. This action is defined in the view
controller as follows:
public ActionResult GoogleDocs()
{
return StiMvcDesigner.GoogleDocsResult(this.Request);
}
ExitDesigner
The action ExitDesigner is called when pressing the Exit button in the main menu of the web designer.
If this action is not specified, then when pressing this button you will be navigated to the URL address
listed in the MainMenuExitUrl property of the web designer. If this property is also not specified, then
the Exit button will be hidden. An example of using the ExitDesigner:
public ActionResult ExitDesigner()
{
return View("MainPage");
}
2003-2013 Stimulsoft
54
ActionGetLocalization = "GetLocalization",
MainMenuExitUrl = "http://stimulsoft.com"
})%>
Razor:
@Html.Stimulsoft().StiMvcDesigner(new StiMvcDesignerOptions() {
ActionGetReportTemplate = "GetReportTemplate",
ActionGetLocalization = "GetLocalization",
MainMenuExitUrl = "http://stimulsoft.com"
})
7.11.1 Actions
This group includes properties that define the name of actions in the view controller, which will call the
client side report designer using the appropriate functions. The group includes the following
properties:
Name
Description
Controller
Specifies the action method name of processing queries of the web report
designer. If the property is not specified, then the current controller will be used
for processing queries.
ActionGetReport
Template
Specifies the action method name of preparing a rendered report for preview.
GetReportCode
2003-2013 Stimulsoft
55
Stimulsoft Reports
ActionExportRep Specifies the action method name of exporting a report to the required format.
ort
ActionGetLocaliz Specifies the action method name of loading localization files for the web
ation
designer.
ActionDataProce Specifies the action method name for processing data on the server side.
ssing
ActionGoogleDo
cs
Specifies the action method name for working with the Google Docs repository.
ActionExitDesig
ner
Specifies the action method name for transition to the desired representation
when closing the web designer.
7.11.2 Connection
The properties described below are responsible for connecting the client and server sides.
Name
Description
ConnectionClien
tRequestTimeou
t
Sets time (in seconds) that the client side will wait for the response from the
server side. The default value is 20 seconds.
ConnectionClien
tRepeatCount
Sets the number of repeats of requests of the server side to the client side, when
getting errors of obtaining data. The default value is 1 repeat.
ConnectionEnabl Allows enabling logging of the requests/responses, and then saving to a text log
eDataLogger
file. By default, this property is set to false, i.e. logging of the requests/
responses, and then saving to a text log file is not performed.
ConnectionShow Used if you want to display the Cancel button in the window of getting the data.
CancelButton
It can be useful if to set long waiting time of response. By default, this property is
set to false, i.e. the button is not displayed.
2003-2013 Stimulsoft
Name
56
Description
AboutDialogTex
tLine1
Sets an additional text information in the dialog box in the first line.
AboutDialogTex
tLine2
Sets an additional text information in the dialog box in the second line.
AboutDialogUrl
Sets an additional URL in the dialog box, which, when clicked, will be open in a
browser window.
AboutDialogUrlT Sets an additional text for the URL in the dialog box "About". If no text is
ext
specified, the URL will be displayed as a text.
7.11.4 Dictionary
This group includes the properties responsible for enabling/disabling actions with report data
dictionary. This group includes the following properties:
Name
Description
AllowModifyDict Enables/disables the creation and editing of the report data dictionary. If the
ionary
property is set to true, the creation and editing is enabled. If, it is set to false,
then editing is disabled. By default the value is set to true.
AllowModifyCon Enables/disables creating and editing of the connections in the report data
nections
dictionary. If the property is set to true, the creation and editing is enabled. If, it
is set to false, then editing is disabled. By default the value is set to true.
AllowModifyDat
aSources
Enables/disables the creating and editing data sources in the report data
dictionary. If the property is set to true, the creation and editing is enabled. If, it
is set to false, then editing is disabled. By default the value is set to true.
AllowModifyRela Enables/disables the creating and editing relations in the report data dictionary.
tions
If the property is set to true, the creation and editing is enabled. If, it is set to
false, then editing is disabled. By default the value is set to true.
AllowModifyVari Enables/disables the creating and editing variables in the report data dictionary.
ables
If the property is set to true, the creation and editing is enabled. If, it is set to
false, then editing is disabled. By default the value is set to true.
ShowConnection Shows/hides the connection type in the report data dictionary. If the property is
Type
set to true, the connection type will be shown next to its name. If the property is
set to false, only the connection name will be displayed. By default the value is
set to true.
ShowTestConnec Shows/hides the test connection button to the database in the create connection
tionButton
dialog. If the property is set to true, the button will be shown. If the property is
2003-2013 Stimulsoft
57
Stimulsoft Reports
set to false, the button will be hidden. By default the value is set to true.
ShowOnlyAliasF
orBusinessObjec
t
Shows an alias when displaying business objects in the data dictionary of the
web designer. If the property is set to true, only the alias will be displayed in the
data dictionary. If the property is set to false, then the name and alias, if it is
specified, are displayed in the data dictionary. By default the value is set to true.
ShowOnlyAliasF
orDatabase
Shows only an alias when displaying connections in the data dictionary of the
web designer. If the property is set to true, only the alias will be displayed in the
data dictionary. If the property is set to false, then the name and alias, if it is
specified, are displayed in the data dictionary. By default the value is set to true.
ShowOnlyAliasF
orDataSource
Shows only an alias when displaying data sources in the data dictionary of the
web designer. If the property is set to true, only the alias will be displayed in the
data dictionary. If the property is set to false, then the name and alias, if it is
specified, are displayed in the data dictionary. By default the value is set to true.
ShowOnlyAliasF
orDataRelation
Shows only an alias when displaying relations in the data dictionary of the web
designer. If the property is set to true, only the alias will be displayed in the data
dictionary. If the property is set to false, then the name and alias, if it is specified,
are displayed in the data dictionary. By default the value is set to true.
ShowOnlyAliasF
orDataColumn
Shows only an alias when displaying data columns in the data dictionary of the
web designer. If the property is set to true, only the alias will be displayed in the
data dictionary. If the property is set to false, then the name and alias, if it is
specified, are displayed in the data dictionary. By default the value is set to true.
ShowOnlyAliasF
orVariable
Shows only an alias when displaying the report variables in the data dictionary of
the web designer. If the property is set to true, only the alias will be displayed in
the data dictionary. If the property is set to false, then the name and alias, if it is
specified, are displayed in the data dictionary. By default the value is set to true.
Description
MainMenuShowNe
w
Enables/disables the submenu item New. If the property is set to true, the
submenu item will be enabled and available to the user. If it is set to false,
then the submenu item will be visible but not available to the user. By default,
this property is set to true. The menu item New contains a submenu, which
contains items such as: New Report, New Report With Wizard, New Page. To
disable these items individually, you can use the relevant properties described
below.
MainMenuShowNe
wReport
Enables/disables the submenu item New Report. If the property is set to true,
the submenu item will be enabled and available to the user. If it is set to false,
then the submenu item will be visible but not available to the user. By default,
2003-2013 Stimulsoft
58
Enables/disables the submenu item New Report With Wizard. If the property
is set to true, the submenu item will be enabled and available to the user. If it
is set to false, then the submenu item will be visible but not available to the
user. By default, this property is set to true.
MainMenuShowNe
wPage
Enables/disables the submenu item New Page. If the property is set to true,
the submenu item will be enabled and available to the user. If it is set to false,
then the submenu item will be visible but not available to the user. By default,
this property is set to true.
MainMenuShowOp Enables/disables the submenu item Open Report from Google Docs. If the
enReportFromGoog property is set to true, the submenu item will be enabled and available to the
leDocs
user. If it is set to false, then the submenu item will be visible but not available
to the user. By default, this property is set to true.
MainMenuShowOp
enReport
MainMenuShowSav
eReport
Enables/disables the submenu item Save Report. If the property is set to true,
the submenu item will be enabled and available to the user. If it is set to false,
then the submenu item will be visible but not available to the user. By default,
this property is set to true.
MainMenuShowSav
eAs
Enables/disables the submenu item Save As. If the property is set to true, the
submenu item will be enabled and available to the user. If it is set to false,
then the submenu item will be visible but not available to the user. By default,
this property is set to true.
MainMenuShowSav
eAsToGoogleDocs
MainMenuShowDel
etePage
Enables/disables the submenu item Delete Page. If the property is set to true,
the submenu item will be enabled and available to the user. If it is set to false,
then the submenu item will be visible but not available to the user. By default,
this property is set to true.
MainMenuShowPre
view
Enables/disables the submenu item Preview. If the property is set to true, the
submenu item will be enabled and available to the user. If it is set to false,
then the submenu item will be visible but not available to the user. By default,
this property is set to true. The menu item Preview contains a submenu, which
contains items such as: Preview as PDF, Preview as HTML, Preview as XPS. To
disable these items individually, you can use the relevant properties described
below.
MainMenuShowPre
viewAsPdf
2003-2013 Stimulsoft
59
Stimulsoft Reports
MainMenuShowPre
viewAsXps
MainMenuShowClo
se
Enables/disables the menu item Preview as XPS. If the property is set to true,
the menu item will be enabled and available to the user. If it is set to false,
then the menu item will be visible but not available to the user. By default, this
property is set to true.
MainMenuShowExit If the property is set to true, the button will be shown in the main menu. If it is
Button
set to false, then the button will be hidden. By default, this property is set to
true.
MainMenuExitUrl
Sets the URL address, by which the transition will be made when clicking the
button Exit. If an action ActionExitDesigner is defined, then it has more
priority.
7.11.6 Toolbars
This group includes the properties responsible for customizing the toolbar. This group includes the
following properties:
Name
Description
ShowAboutButto Shows/hides the button About. If the property is set to true, then this button will
n
be displayed. If the property is set to false the button will be hidden. By default,
this property is set to true.
ShowCodeTab
Shows/hides the tab Code in the tabs panel. If the property is set to true, then
this tab will be displayed. If the property is set to false the tab will be hidden. By
default, this property is set to true.
ShowPreviewRep Shows/hides the tab Preview in the tabs panel. If the property is set to true, then
ortTab
this tab will be displayed. If the property is set to false the tab will be hidden. By
default, this property is set to true.
ShowDictionaryT Shows/hides the tab Dictionary in the properties panel. If the property is set to
ab
true, then this tab will be displayed. If the property is set to false the tab will be
hidden. By default, this property is set to true.
ShowEventsTab
Shows/hides the tab Events in the properties panel. If the property is set to true,
then this tab will be displayed. If the property is set to false the tab will be
hidden. By default, this property is set to true.
2003-2013 Stimulsoft
60
7.11.7 Zooming
With this group of properties one can modify zooming options. This group is represented by the
following properties The Zoom property. Depending on the value of the property the parameters of
zooming of the report template will be applied. This property can have numeric values in the range
from 10 to 500, which correspond to the scale from 10% to 500%. Also, the property can take values
from an enumeration StiMvcDesignerOptions.ZoomMode.
Name
Description
Default
The report is shown in zoom used in the last time when the web designer was
open.
OnePage
Sets zoom by one page. So the entire page of the report template fits in the
window of the web designer.
PageWidth
Sets zoom by page width. So the width of the report template matches the width
of the web designer window.
PageHeight
Sets zoom by page height. So the height of the report template matches the
height of the web designer window.
7.11.8 Interface
With this group of properties one can modify interface options. This group is represented by the
following properties.
Name
Description
Width
Sets the width of the component. Width units are defined in the Unit class. The
following values are available: in pixels - Unit.Pixel(), in points - Unit.Point())
in per cent - Unit.Percentage().
Height
Sets the height of the component. Height units are defined in the Unit class.
The following values are available: in pixels - Unit.Pixel(), in points - Unit.
Point()) in per cent - Unit.Percentage().
7.11.9 Miscellaneous
In addition to the properties of the major groups, there are additional, which provide certain additional
features. Consider these features in more detail:
Name
2003-2013 Stimulsoft
Description
61
Stimulsoft Reports
AllowModifyTe
mplate
AutoSaveInterval Sets the time interval (in minutes), through which a web designer will
automatically call the action of saving the report. If the interval is 0 minutes, the
auto save is disabled. By default the value is set to 0 minutes.
LocalizationDire
ctory
SaveReportTemp Manages the process of saving the report. Can take one of the three values of
lateAsMode
the enumeration StiMvcDesignerOptions.SaveMode: Hidden, Visible or
NewWindow. If the property is set to Visible, then report saving will be called in
the current browser window in the visible mode. If the property is set to
NewWindow, then the report saving will be called in a new browser window. By
default, this property is set to Hidden, that is, the action to save a report called
in the AJAX mode and will not appear in the browser window.
RunWizardAfterL Provides the ability to display the report creation wizard when you running the
oad
web designer. If the property is set to false, then, when running the web
designer, the report wizard is not displayed. If the property is set to true, then,
when you run the web designer of rendering a report, the wizard will be
displayed. By default, this property is set to false.
BrowserTitle
Used to change the browser title. This property can take string values. If the
property is not specified, the browser title is the Report Alias, and in his absence
- the name of the report (Report Name).
7.11.10 Viewer
Setting the report viewer can be done using the properties. Properties can be divided into following
groups: Toolbars, Exporting, Printing, Buttons.
7.11.10.1 Exporting
With this group of properties one can modify exporting options. This group is represented by the
following properties.
Name
Description
ViewerShowExportDi
alog
Shows/hides the exporting dialog. If the property is set to true, the dialog
will be displayed. If it is set to false, then the dialog will be hidden. By
default, this property is set to true.
ViewerShowExportTo
Shows/hides the menu item Document File. If the property is set to true, the
2003-2013 Stimulsoft
62
Document
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ViewerShowExportTo
Pdf
Shows/hides the menu item Adobe PDF File. If the property is set to true,
the menu item will be displayed. If it is set to false, then the menu item will
be hidden. By default, this property is set to true.
ViewerShowExportTo
Xps
Shows/hides the menu item Microsoft XPS File. If the property is set to true,
the menu item will be displayed. If it is set to false, then the menu item will
be hidden. By default, this property is set to true.
ViewerShowExportTo
Ppt
ViewerShowExportTo
Html
Shows/hides the menu item HMTL File. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ViewerShowExportTo
Mht
Shows/hides the menu item MHT Web Archive. If the property is set to true,
the menu item will be displayed. If it is set to false, then the menu item will
be hidden. By default, this property is set to true.
ViewerShowExportTo
Text
Shows/hides the menu item Text File. If the property is set to true, the menu
item will be displayed. If it is set to false, then the menu item will be hidden.
By default, this property is set to true.
ViewerShowExportTo
Rtf
Shows/hides the menu item Rich Text File. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ViewerShowExportTo
Word2007
Shows/hides the menu item Microsoft Word 2007/2010 File. If the property
is set to true, the menu item will be displayed. If it is set to false, then the
menu item will be hidden. By default, this property is set to true.
ViewerShowExportTo
OpenDocumentWrite
r
Shows/hides the menu item OpenDocument Writer File. If the property is set
to true, the menu item will be displayed. If it is set to false, then the menu
item will be hidden. By default, this property is set to true.
ViewerShowExportTo
Excel
Shows/hides the menu item Microsoft Excel File. If the property is set to
true, the menu item will be displayed. If it is set to false, then the menu item
will be hidden. By default, this property is set to true.
ViewerShowExportTo
ExcelXml
Shows/hides the menu item Microsoft Excel Xml File. If the property is set to
true, the menu item will be displayed. If it is set to false, then the menu item
will be hidden. By default, this property is set to true.
ViewerShowExportTo
Excel2007
Shows/hides the menu item Microsoft Excel 2007/2010 File. If the property
is set to true, the menu item will be displayed. If it is set to false, then the
menu item will be hidden. By default, this property is set to true.
ViewerShowExportTo
OpenDocumentCalc
Shows/hides the menu item OpenDocument Calc File. If the property is set
to true, the menu item will be displayed. If it is set to false, then the menu
item will be hidden. By default, this property is set to true.
2003-2013 Stimulsoft
63
Stimulsoft Reports
ViewerShowExportTo
Csv
Shows/hides the menu item CSV File. If the property is set to true, the menu
item will be displayed. If it is set to false, then the menu item will be hidden.
By default, this property is set to true.
ViewerShowExportTo
Dbf
Shows/hides the menu item DBF File. If the property is set to true, the menu
item will be displayed. If it is set to false, then the menu item will be hidden.
By default, this property is set to true.
ViewerShowExportTo
Xml
Shows/hides the menu item XML File. If the property is set to true, the menu
item will be displayed. If it is set to false, then the menu item will be hidden.
By default, this property is set to true.
ViewerShowExportTo
Dif
Shows/hides the menu item Data Interchange Format (DIF) File. If the
property is set to true, the menu item will be displayed. If it is set to false,
then the menu item will be hidden. By default, this property is set to true.
ViewerShowExportTo
Sylk
Shows/hides the menu item Symbolic Link (SYLK) File. If the property is set
to true, the menu item will be displayed. If it is set to false, then the menu
item will be hidden. By default, this property is set to true.
ViewerShowExportTo
Bmp
Shows/hides the menu item BMP Image. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ViewerShowExportTo
Gif
Shows/hides the menu item GIF Image. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ViewerShowExportTo
Jpeg
Shows/hides the menu item JPEG Image. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ViewerShowExportTo
Pcx
Shows/hides the menu item PCX Image. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ViewerShowExportTo
Png
Shows/hides the menu item PNG Image. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ViewerShowExportTo
Tiff
Shows/hides the menu item TIFF Image. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ViewerShowExportTo
Metafile
Shows/hides the menu item Windows Metafile. If the property is set to true,
the menu item will be displayed. If it is set to false, then the menu item will
be hidden. By default, this property is set to true.
ViewerShowExportTo
Svg
Shows/hides the menu item Scalable Vector Graphics (SVG) File. If the
property is set to true, the menu item will be displayed. If it is set to false,
then the menu item will be hidden. By default, this property is set to true.
ViewerShowExportTo
Svgz
Shows/hides the menu item Compressed SVG (SVGZ) File. If the property is
set to true, the menu item will be displayed. If it is set to false, then the
2003-2013 Stimulsoft
64
7.11.10.2 Printing
With this group of properties one can modify printing options. This group is represented by the
following properties.
Name
Description
PrintAutoPageOrient
ation
PrintAllowToPdf
Shows/hides the menu item Print to PDF in the report printing dialog box. If
the property is set to true, the menu item will be displayed. If it is set to
false, then the menu item will be hidden. By default, this property is set to
true.
PrintAllowToHtml
Shows/hides the menu item Print to HTML in the report printing dialog box.
If the property is set to true, the menu item will be displayed. If it is set to
false, then the menu item will be hidden. By default, this property is set to
true.
7.11.10.3 Toolbars
This group includes properties that shows or hides the report viewer toolbars.
Name
Description
ViewerShowTool Shows/hides the main toolbar of the report viewer. If the property is set to true,
barMain
the toolbar will be displayed. If the property is set to false, the toolbar will be
hidden. By default, this property is set to true.
ViewerShowTool Shows/hides the navigation toolbar of the report viewer. If the property is set to
barNavigate
true, the toolbar will be displayed. If the property is set to false, the toolbar will
be hidden. By default, this property is set to true.
ViewerShowTool Shows/hides the toolbar of the report viewer where one can choose the mode of
barViewMode
viewing reports. If the property is set to true, the toolbar will be displayed. If the
property is set to false, the toolbar will be hidden. By default, this property is set
to true.
7.11.10.4 Buttons
This group includes the properties which show or hide the appropriate buttons on the report viewer
2003-2013 Stimulsoft
65
Stimulsoft Reports
toolbars:
Name
Description
ViewerShowButtonPrin Shows/hides the Print button on the toolbar. If the property is set to true,
t
the button will be displayed. If it is set to false, then the button will be
hidden. By default, this property is set to true.
ViewerShowButtonOpe Shows/hides the Open button on the toolbar. If the property is set to true,
n
the button will be displayed. If it is set to false, then the button will be
hidden. By default, this property is set to true.
ViewerShowButtonSav
e
Shows/hides the Save button on the toolbar. If the property is set to true,
the button will be displayed. If it is set to false, then the button will be
hidden. By default, this property is set to true.
ViewerShowButtonBoo
kmarks
ViewerShowButtonPara Shows/hides the Parameters button on the toolbar. If the property is set
meters
to true, the button will be displayed. If it is set to false, then the button will
be hidden. By default, this property is set to true.
ViewerShowPanelPara
meters
ViewerShowButtonThu
mbnails
ViewerShowButtonFind Shows/hides the Find button on the toolbar. If the property is set to true,
the button will be displayed. If it is set to false, then the button will be
hidden. By default, this property is set to true.
ViewerShowButtonFull
Screen
ViewerShowButtonFirst Shows/hides the FirstPage button on the toolbar. If the property is set to
Page
true, the button will be displayed. If it is set to false, then the button will be
hidden. By default, this property is set to true.
ViewerShowButtonPrev Shows/hides the PreviousPage button on the toolbar. If the property is set
iousPage
to true, the button will be displayed. If it is set to false, then the button will
be hidden. By default, this property is set to true.
ViewerShowButtonGoT
oPage
ViewerShowButtonNex
tPage
2003-2013 Stimulsoft
66
ViewerShowButtonPag Shows/hides the Continuous button on the toolbar. If the property is set
eViewModeContinuous to true, the button will be displayed. If it is set to false, then the button will
be hidden. By default, this property is set to true.
ViewerShowButtonPag
eViewModeMultiple
8.1
How It Works?
To run the viewer you need to place the StiMvcViewer component on the ASP.NET page. Set the
necessary properties to the StiMvcViewer component, and, in the view controller, define the necessary
actions. The following steps occur when running the viewer:
The .NET component stores the report in the cache or server session and generates the HTML code
of the viewer.
When the viewer components are output, the Javascript is running. It requests one report page or
the entire report (depending on the selected mode) on the server side.
When exporting or printing, the report viewer calls the action that must return to a definite answer.
8.2
Showing Reports
To run the report viewer it is necessary on main master-page of the application to place a code for
adding java-scripts, which are required for the component. This code is placed in the container
<head>:
2003-2013 Stimulsoft
67
Stimulsoft Reports
ASPX:
<head runat="server">
<%= Html.Stimulsoft().RenderMvcViewerScripts() %>
</head>
Razor:
<head runat="server">
@Html.Stimulsoft().RenderMvcViewerScripts()
</head>
To display reports place the StiMvcViewer component on the ASP.NET page and set necessary
properties to that component, and define the necessary steps in the view controller:
ASPX:
<%= Html.Stimulsoft().StiMvcViewer(
"MvcViewer1",
new StiMvcViewerOptions() {
ActionGetReportSnapshot = "GetReportSnapshot",
ActionViewerEvent = "ViewerEvent",
Width = Unit.Percentage(100)
})%>
Razor:
@Html.Stimulsoft().StiMvcViewer(
"MvcViewer1",
new StiMvcViewerOptions() {
ActionGetReportSnapshot = "GetReportSnapshot",
ActionViewerEvent = "ViewerEvent",
Width = Unit.Percentage(100)
})
Controller:
public ActionResult GerReportSnapshot()
{
StiReport report = new StiReport();
report.Load(Server.MapPath("~/Content/SimpleList.mdc"));
return StiMvcViewer.GetReportSnapshotResult(this.HttpContext,
report);
}
public ActionResult ViewerEvent()
2003-2013 Stimulsoft
68
{
return StiMvcViewer.ViewerEventResult(this.HttpContext);
}
If the report has not been built before it is displayed, the StiMvcViewer component renders it
automatically. Thus, for displaying reports, it is allowed using report templates and reports as classes:
Controller:
public ActionResult GetReportSnapshot()
{
StiReport report = new StiReport();
report.Load(Server.MapPath("~/Content/SimpleList.mdc"));
return StiMvcViewer.GetReportSnapshotResult(this.HttpContext,
report);
}
Controller:
public ActionResult GetReportSnapshot()
{
StiReport report = new StiReportCompiledClass();
return StiMvcViewer.GetReportSnapshotResult(this.HttpContext,
report);
}
8.3
Localizing Component
In order to localize the interface of the report viewer a special Localization property is used. The value
of this property should point to the localization XML-file (relative or absolute):
ASPX:
<%= Html.Stimulsoft().StiMvcViewer(new StiMvcViewerFxOptions() {
Localization = " ~/Content/Localization/en.xml"
})%>
Razor:
@Html.Stimulsoft().StiMvcViewerFx(new StiMvcViewerFxOptions() {
Localization = " ~/Content/Localization/en.xml"
})
2003-2013 Stimulsoft
69
8.4
Stimulsoft Reports
Using Themes
The StiMvcViewer component has the ability to change the theme of visual controls. To change the
theme the Theme property is used, which can take one of the enumeration values StiTheme. The
property value is specified in a moment of generating scripts and viewer styles:
ASPX:
<%= Html.Stimulsoft().StiMvcViewer(new StiMvcViewerFxOptions() {
Theme = StiTheme.Office2010
})%>
Razor:
@Html.Stimulsoft().StiMvcViewerFx(new StiMvcViewerFxOptions() {
Theme = StiTheme.Office2010
})
Office2003:
2003-2013 Stimulsoft
Offile2010:
2003-2013 Stimulsoft
70
71
Stimulsoft Reports
WindowsXP:
2003-2013 Stimulsoft
72
Windows7:
Additionally, the possibility to specify the font (the ToolbarFontFamily property) and the font color
(the ToolbarFontColor property) toolbar, as well as the toolbar color for the Default theme (the
ToolbarBackgroundColor property).
8.5
Razor:
2003-2013 Stimulsoft
73
Stimulsoft Reports
@Html.Stimulsoft().StiMvcViewer(
"MvcViewer1",
new StiMvcViewerOptions() {
ActionViewerEvent = "ViewerEvent"
})
Controller:
public ActionResult ViewerEvent()
{
return StiMvcViewer.ViewerEventResult(this.HttpContext);
}
This action returns the HTML report page (or a set of HTML pages), rendered with the new settings
on the viewer panel.
8.6
Printing
Print to PDF
Printing will be done by exporting the report to the PDF format. The advantages include more accurate
location and printing of report components compared to other printing options. Disadvantages required installed browser plug-in to view the PDF.
Print with Preview
Print a report will be made in the pop-up separate browser window. The report can be viewed and, if
necessary, send to a printer or copy to another location as a text or HTML code.
Print without Preview
Print a report will be made directly to the printer without preview. After selecting this menu item, a
printing dialog box is shown.
Important: It is necessary to make sure in correspondence of report page settings and page setup
of your printer (paper size, margins, padding), and check the browser print settings.
To work correctly of the printing function it is necessary to define a special action ActionPrintReport:
ASPX:
<%= Html.Stimulsoft().StiMvcViewer(
"MvcViewer1",
new StiMvcViewerOptions() {
ActionPrintReport = "PrintReport"
})%>
Razor:
2003-2013 Stimulsoft
74
@Html.Stimulsoft().StiMvcViewer(
"MvcViewer1",
new StiMvcViewerOptions() {
ActionPrintReport = "PrintReport"
})
Controller:
public ActionResult PrintReport()
{
return StiMvcViewer.PrintReportResult(this.HttpContext);
}
8.7
Viewing Modes
The StiMvcViewer component has two modes of displaying reports: with scrollbars and without
scrollbars. The ScrollbarsMode option operates this and can take values True or False. In the first
mode without scrollbars (which is set by default), the viewer displays the page or the entire report,
automatically stretching the viewing area. If you set the size by width and height, the viewer cuts the
page that goes out of bounds. In the second mode, in contrast to the first, with the event page for the
border size viewer crop will fail. Instead, the scroll bar appears, using what you can view the page or
the entire report. This mode is useful when you need a compact viewer on a web page, while not
limiting the viewing area of the report:
2003-2013 Stimulsoft
75
8.8
Stimulsoft Reports
Using Parameters
A special Parameters panel is implemented for working with report parameters in MvcViewer. To add
a parameter to the panel you need, in a report, to define a variable requested by the user. When
previewing a report in the viewer such a variable will be automatically added to the Parameters panel.
It supports all types of report variables (normal variables, date and time, borders, lists, and so on). To
work correctly with parameters you need to define the specific action ActionInteraction:
ASPX:
<%= Html.Stimulsoft().StiMvcViewer(
"MvcViewer1",
new StiMvcViewerOptions() {
ActionInteraction = "Interaction"
})%>
Razor:
@Html.Stimulsoft().StiMvcViewer(
"MvcViewer1",
new StiMvcViewerOptions() {
ActionInteraction = "Interaction"
})
Controller:
public ActionResult Interaction()
{
return StiMvcViewer.InteractionResult(this.HttpContext);
}
If the specified event is not defined, the parameters panel will not be displayed even if the variables,
requested by the user, are present in the report.
8.9
Viewer Settings
Setting the StiMvcViewer is performed with properties that are in the StiMvcViewerOptions class.
Properties of this class can be divided into the following categories: Action, Working with the server,
Interface, Toolbar, Buttons, Export. Consider these groups in more detail.
8.9.1
Actions
This group includes properties that define the names of actions in the view controller, which will cause
the client side report viewer using the appropriate functions.
2003-2013 Stimulsoft
Name
8.9.2
76
Description
Controller
ActionGetReportSnapsh
ot
ActionViewerEvent
Specifies the name of the action method of the viewer events, such as
flipping through the report pages, selecting zoom, changing the display
mode of pages.
ActionPrintReport
ActionExportReport
Specifies the name of the action method of exporting the report to the
desired format.
ActionDesignReport
Connection
This group includes the properties that are responsible for the connecting parameters of the client and
server sides.
Name
Description
ServerTimeout
Sets time that the server will store a rendered report since the last
viewer action, by default it is set to 10 minutes.
ServerCacheAsObject
Sets the mode of saving the report as an object in the server cache.
It is enabled by default.
ServerCacheMode
Sets the mode of report caching. Can accept one of three values:
StiCacheMode.None caching is disabled, the report will be
loaded each time anew, using the ActionGetReportSnapshot
action.
StiCacheMode.Page as a storage the cache server is used
(the default value).
StiCacheMode.Session as a storage the session is used.
ServerCacheItemPriority
Provides the ability to set the priority of stored in the cache report
server. This property affects the automatic cleaning of the server's
memory in the event of its shortage. The lower the priority is, the
greater is a chance of removing information from memory.
2003-2013 Stimulsoft
77
8.9.3
Stimulsoft Reports
Toolbar
This group includes properties that affect displaying the toolbar and its elements:
Name
8.9.4
Description
ToolbarVisible
ToolbarAlignment
ToolbarButtonCaptions
ToolbarMenuCaptions
ShowCurrentPageControl
Buttons
This group includes properties that provide the possibility to show or hide the appropriate buttons on
the report viewer toolbar:
Name
Description
ShowButtonPrint
Shows/hides the button Print. True - button is shown, false the button is hidden.
ShowButtonSave
Shows/hides the button Save. True - button is shown, false the button is hidden.
ShowButtonBookmarks
ShowButtonFirstPage
ShowButtonPreviousPage
2003-2013 Stimulsoft
8.9.5
78
ShowButtonNextPage
ShowButtonLastPage
ShowButtonZoom
Shows/hides the button Zoom. True - button is shown, false the button is hidden.
ShowButtonViewMode
ShowButtonDesign
Shows/hides the button Design. True - button is shown, false the button is hidden.
Exporting Reports
With this group of properties, you can configure the menu to exporting reports.
Name
Description
ShowExportDialog
ShowExportToDocument
ShowExportToPdf
Shows/hides the item Adobe PDF File. True - the item is shown,
false - the item is hidden.
ShowExportToXps
ShowExportToPowerPoint
ShowExportToHtml
Shows/hides the item HMTL File. True - the item is shown, false the item is hidden.
ShowExportToHtml5
Shows/hides the item HMTL5 File. True - the item is shown, false
- the item is hidden.
ShowExportToMht
ShowExportToText
Shows/hides the item Text File. True - the item is shown, false the item is hidden.
ShowExportToRtf
Shows/hides the item Rich Text File. True - the item is shown,
false - the item is hidden.
ShowExportToWord2007
2003-2013 Stimulsoft
79
Stimulsoft Reports
ShowExportToExcel
ShowExportToExcelXml
Shows/hides the item Microsoft Excel Xml File. True - the item is
shown, false - the item is hidden.
ShowExportToExcel2007
ShowExportToOpenDocumentC
alc
ShowExportToCsv
Shows/hides the item CSV File. True - the item is shown, false the item is hidden.
ShowExportToDbf
Shows/hides the item DBF File. True - the item is shown, false the item is hidden.
ShowExportToXml
Shows/hides the item XML File. True - the item is shown, false the item is hidden.
ShowExportToDif
Shows/hides the item Data Interchange Format (DIF) File. True the item is shown, false - the item is hidden.
ShowExportToSylk
Shows/hides the item Symbolic Link (SYLK) File. True - the item is
shown, false - the item is hidden.
ShowExportToImageBmp
Shows/hides the item BMP Image. True - the item is shown, false
- the item is hidden.
ShowExportToImageGif
Shows/hides the item GIF Image. True - the item is shown, false the item is hidden.
ShowExportToImageJpeg
Shows/hides the item JPEG Image. True - the item is shown, false
- the item is hidden.
ShowExportToImagePcx
Shows/hides the item PCX Image. True - the item is shown, false the item is hidden.
ShowExportToImagePng
Shows/hides the item PNG Image. True - the item is shown, false
- the item is hidden.
ShowExportToImageTiff
Shows/hides the item TIFF Image. True - the item is shown, false the item is hidden.
ShowExportToImageMetafile
ShowExportToImageSvg
Shows/hides the item Scalable Vector Graphics (SVG) File. True the item is shown, false - the item is hidden.
ShowExportToImageSvgz
2003-2013 Stimulsoft
80
8.9.6
Interface
This group includes properties represents the report viewer and its elements.
Name
Description
Theme
Provides the ability to change the viewer theme. The list of available
themes is in the StiTheme class.
ToolbarFontFamily
Provides the ability to change the font for the toolbar and menu.
ToolbarFontColor
Provides the ability to change the color of the toolbar and menu.
ToolbarBackgroundCol Provides the ability to change the color of the toolbar. Applicable only for
or
the Default theme.
Width
Specifies the width of the component in the required units, which are
defined in the Unit class. Available setting of values in pixels - Unit.Pixel(),
points - Unit.Point(), and per cent - Unit.Percentage().
Height
Specifies the height of the component in expected units, which are defined
in the Unit class. Available setting of values in pixels - Unit.Pixel(), in points
- Unit.Point(), and per cent - Unit.Percentage().
Localization
Specifies the path to the localization XML file. The path can be as an
absolute or relative.
RightToLeft
Sets the mode of displaying Right to Left the controls of the report viewer.
By default it is disabled.
ScrollbarsMode
MenuAnimation
MenuShowMode
MenuPrintDestination
2003-2013 Stimulsoft
81
Stimulsoft Reports
MenuViewMode
Sets the displaying mode of report pages. It can take one of the following
values:
StiWebViewMode.OnePage - shows one report page, the selected
toolbar of the report viewer (the default value).
StiWebViewMode.WholeReport - displayed at once all report pages.
MenuZoom
Provides the ability to set the display scale of the report pages.
PageAlignment
Specifies the position of a report page in the report viewer. Can take the
following values:
StiContentAlignment.Left - the page will be docked to the left edge.
StiContentAlignment.Center - the page will be centered (the default
value).
StiContentAlignment.Right - the page will be docked to the right
edge.
PageShowShadow
Provides the ability to hide the shadow of report pages. By default, the
shadow is enabled.
PageBorderColor
Provides ability to set the border color of the report page. The default
color is Color.Gray. You can select any color value. If to set the value Color.
Transparent, the borders of the report page will be displayed.
BookmarksVisible
Provides the ability to disable report tabs, even if they present in the
report. By default the property is enabled.
BookmarksPrint
Provides the ability to print the report tabs on the printer (in addition to
the report). By default, the property is disabled.
BookmarksTreeWidth
Provides the ability to set the width in pixels of the bookmarks bar. By
default the width is 180 pixels.
2003-2013 Stimulsoft
9.1
82
How It Works?
To run the web reports designer, it is required to put the StiMvcViewerFx component on the ASP.NET
page, set the required properties, and define necessary actions in the view controller. When running
the report viewer the following actions occur:
The .NET component reads to the memory the client Flash application from resources and runs it.
When it is loaded, the client side requests a report that should be returned by action set and
defined in the controller settings.
When exporting a report, the client side calls an action, which also must return the specific response.
9.2
Razor:
<head runat="server">
@Html.Stimulsoft().RenderMvcViewerFxScripts()
</head>
To view the report you should add the StiMvcViewerFx component to an ASP.NET page, and set it the
necessary properties, and in the view controller, to determine the necessary steps:
ASPX:
<%= Html.Stimulsoft().StiMvcViewerFx(new StiMvcViewerFxOptions() {
ActionGetReportSnapshot = "GetReportSnapshot",
Width = Unit.Pixel(600),
Height = Unit.Pixel(480)
})%>
Razor:
@Html.Stimulsoft().StiMvcViewerFx(new StiMvcViewerFxOptions() {
ActionGetReportSnapshot = "GetReportSnapshot",
Width = Unit.Pixel(600),
Height = Unit.Pixel(480)
})
2003-2013 Stimulsoft
83
Stimulsoft Reports
Controller:
public ActionResult GetReportSnapshot()
{
StiReport report = new StiReport();
report.Load(Server.MapPath("~/Content/SimpleList.mdc"));
return StiMvcViewerFx.GetReportSnapshotResult(report);
}
If the report was not rendered before showing, then the StiMvcViewerFx component renders it
automatically. Thus, to display the report it is allowed to use report templates and reports as classes:
Controller:
public ActionResult GetReportSnapshot()
{
StiReport report = new StiReport();
report.Load(Server.MapPath("~/Content/SimpleList.mdc"));
return StiMvcViewerFx.GetReportSnapshotResult(report);
}
Controller:
public ActionResult GetReportSnapshot()
{
StiReport report = new StiReportCompiledClass();
return StiMvcViewerFx.GetReportSnapshotResult(report);
}
Controller:
public ActionResult GetReportSnapshot()
{
StiReport report = new StiReportCompiledClass();
return StiMvcViewerFx.GetReportSnapshotResult(report);
}
9.3
Localizing Component
In order to localize the interface of the report viewer in the language you need, use the special
operation, that has the recommended name GetLocalization. This operation must return the required
localization file to the client side:
ASPX:
2003-2013 Stimulsoft
84
Razor:
@Html.Stimulsoft().StiMvcViewerFx(new StiMvcViewerFxOptions() {
ActionGetLocalization = "GetLocalization"
})
Controller:
public ActionResult GetLocalization()
{
string path = Server.MapPath("~/Content/Localization/en.xml");
return StiMvcViewerFx.GetLocalizationResult(path);
}
9.4
Using Themes
In the StiMvcViewerFx component you may change the theme of visual controls. The Theme property
is used to change the theme. The property can take one of the enumeration values of
StiMvcViewerFxOptions.Themes. Currently the following themes are available:
Blue
2003-2013 Stimulsoft
85
Stimulsoft Reports
Silver
Black
2003-2013 Stimulsoft
9.5
86
Viewer Settings
Setting the StiMvcViewerFx component can be done using the properties, which are described in the
StiMvcViewerFxOptions class. Properties of StiMvcViewerFx can be divided into following groups:
Actions, Connection, Dialog Box About, Toolbars, Buttons, Zooming, Exporting, Printing, Interface.
9.5.1
Actions
This group includes properties that define the name of actions in the view controller, which will call the
client side report viewer using the appropriate functions. The group includes the following properties:
Name
Controller
Description
Defines a name of the query processing controller of the report viewer. If the
property is not specified, then the current controller will be used for processing
queries.
ActionGetRep Defines the action method name of preparing the rendered report.
ortSnapshot
ActionGetLoc Defines the action method name of loading a localization file for a web designer.
alization
ActionExport
2003-2013 Stimulsoft
Defines the action method name of exporting a report to the required format.
87
Stimulsoft Reports
Report
ActionExitVie Defines the name of the action method for transition to the desired view when
wer
exiting the report viewer.
9.5.2
Connection
The properties described below are responsible for connecting the client and server sides.
Name
Description
ConnectionClien
tRequestTimeou
t
Sets time (in seconds) that the client side will wait for the response from the
server side. The default value is 20 seconds.
ConnectionClien
tRepeatCount
Sets the number of repeats of requests of the server side to the client side, when
getting errors of obtaining data. The default value is 1 repeat.
ConnectionEnabl Allows enabling logging of the requests/responses, and then saving to a text log
eDataLogger
file. By default, this property is set to false, i.e. logging of the requests/
responses, and then saving to a text log file is not performed.
ConnectionShow Used if you want to display the Cancel button in the window of getting the data.
CancelButton
It can be useful if to set long waiting time of response. By default, this property is
set to false, i.e. the button is not displayed.
9.5.3
Description
AboutDialogTex
tLine1
Sets an additional text information in the dialog box in the first line.
AboutDialogTex
tLine2
Sets an additional text information in the dialog box in the second line.
AboutDialogUrl
Sets an additional URL in the dialog box, which, when clicked, will be open in a
browser window.
2003-2013 Stimulsoft
88
AboutDialogUrlT Sets an additional text for the URL in the dialog box "About". If no text is
ext
specified, the URL will be displayed as a text.
9.5.4
Toolbars
This group includes properties that shows or hides the report viewer toolbars.
Name
Description
ShowToolbarMai
n
Shows/hides the main toolbar of the report viewer. If the property is set to true,
the toolbar will be displayed. If the property is set to false, the toolbar will be
hidden. By default, this property is set to true.
ShowToolbarNavi Shows/hides the navigation toolbar of the report viewer. If the property is set to
gate
true, the toolbar will be displayed. If the property is set to false, the toolbar will
be hidden. By default, this property is set to true.
ShowToolbarView Shows/hides the toolbar of the report viewer where one can choose the mode
Mode
of viewing reports. If the property is set to true, the toolbar will be displayed. If
the property is set to false, the toolbar will be hidden. By default, this property
is set to true.
9.5.5
Buttons
This group includes the properties which show or hide the appropriate buttons on the report viewer
toolbars:
Name
Description
ShowButtonPrint
Shows/hides the Print button on the toolbar. If the property is set to true,
the button will be displayed. If it is set to false, then the button will be
hidden. By default, this property is set to true.
ShowButtonOpen
Shows/hides the Open button on the toolbar. If the property is set to true,
the button will be displayed. If it is set to false, then the button will be
hidden. By default, this property is set to true.
ShowButtonSave
Shows/hides the Save button on the toolbar. If the property is set to true,
the button will be displayed. If it is set to false, then the button will be
hidden. By default, this property is set to true.
ShowButtonBookmark
s
ShowButtonParameter Shows/hides the Parameters button on the toolbar. If the property is set to
2003-2013 Stimulsoft
89
Stimulsoft Reports
true, the button will be displayed. If it is set to false, then the button will be
hidden. By default, this property is set to true.
ShowPanelParameters
ShowButtonThumbnai
ls
ShowButtonFind
Shows/hides the Find button on the toolbar. If the property is set to true,
the button will be displayed. If it is set to false, then the button will be
hidden. By default, this property is set to true.
ShowButtonFullScreen
ShowButtonExit
Shows/hides the Exit button. If the property is set to true, then the button
will be displayed. If it is set to false the button will be hidden. By default,
this property is set to true.
ShowButtonAbout
Shows/hides the About button. If the property is set to true, then the
button will be displayed. If it is set to false the button will be hidden. By
default, this property is set to true.
ShowButtonFirstPage
ShowButtonPreviousP
age
ShowButtonGoToPage
ShowButtonNextPage
ShowButtonLastPage
ShowButtonPageView
ModeSingle
ShowButtonPageView
ModeContinuous
2003-2013 Stimulsoft
ShowButtonPageView
ModeMultiple
9.5.6
90
Zooming
With this group of properties one can modify zooming options. This group is represented by the following
properties.
The Zoom property. Depending on the value of the property the parameters of zooming of the
report template will be applied. This property can have numeric values in the range from 20 to 200,
which correspond to the scale from 20% to 200%. Also, the property can take values from an
enumeration StiMvcViewerFxOptions.ZoomMode.
Name
Description
Default
The report is shown in zoom used in the last time when the web viewer was
open.
OnePage
Sets zoom by one page. So the entire page of the report template fits in the
window of the web viewer.
TwoPages
Sets zoom by two pages. So two report pages will be shown by width and height
of the report viewer.
PageWidth
Sets zoom by page width. So the width of the report template matches the width
of the web viewer window.
PageHeight
Sets zoom by page height. So the height of the report template matches the
height of the web viewer window.
The ZoomShow property. Shows/hides the zooming control from the report viewer. If the property
is set to true, the control will be displayed. If it is set to false, then the control will be hidden. By
default, this property is set to true.
9.5.7
Exporting
With this group of properties one can modify exporting options. This group is represented by the
following properties.
Name
Description
ShowExportDialog
Shows/hides the exporting dialog. If the property is set to true, the dialog
will be displayed. If it is set to false, then the dialog will be hidden. By
default, this property is set to true.
2003-2013 Stimulsoft
91
Stimulsoft Reports
ShowExportToDocum Shows/hides the menu item Document File. If the property is set to true, the
ent
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ShowExportToPdf
Shows/hides the menu item Adobe PDF File. If the property is set to true,
the menu item will be displayed. If it is set to false, then the menu item will
be hidden. By default, this property is set to true.
ShowExportToXps
Shows/hides the menu item Microsoft XPS File. If the property is set to true,
the menu item will be displayed. If it is set to false, then the menu item will
be hidden. By default, this property is set to true.
ShowExportToPpt
ShowExportToHtml
Shows/hides the menu item HMTL File. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ShowExportToMht
Shows/hides the menu item MHT Web Archive. If the property is set to true,
the menu item will be displayed. If it is set to false, then the menu item will
be hidden. By default, this property is set to true.
ShowExportToText
Shows/hides the menu item Text File. If the property is set to true, the menu
item will be displayed. If it is set to false, then the menu item will be hidden.
By default, this property is set to true.
ShowExportToRtf
Shows/hides the menu item Rich Text File. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ShowExportToWord2
007
Shows/hides the menu item Microsoft Word 2007/2010 File. If the property
is set to true, the menu item will be displayed. If it is set to false, then the
menu item will be hidden. By default, this property is set to true.
ShowExportToOpenD
ocumentWriter
Shows/hides the menu item OpenDocument Writer File. If the property is set
to true, the menu item will be displayed. If it is set to false, then the menu
item will be hidden. By default, this property is set to true.
ShowExportToExcel
Shows/hides the menu item Microsoft Excel File. If the property is set to
true, the menu item will be displayed. If it is set to false, then the menu item
will be hidden. By default, this property is set to true.
ShowExportToExcelX
ml
Shows/hides the menu item Microsoft Excel Xml File. If the property is set to
true, the menu item will be displayed. If it is set to false, then the menu item
will be hidden. By default, this property is set to true.
ShowExportToExcel20 Shows/hides the menu item Microsoft Excel 2007/2010 File. If the property
07
is set to true, the menu item will be displayed. If it is set to false, then the
menu item will be hidden. By default, this property is set to true.
ShowExportToOpenD
ocumentCalc
Shows/hides the menu item OpenDocument Calc File. If the property is set
to true, the menu item will be displayed. If it is set to false, then the menu
2003-2013 Stimulsoft
92
Shows/hides the menu item CSV File. If the property is set to true, the menu
item will be displayed. If it is set to false, then the menu item will be hidden.
By default, this property is set to true.
ShowExportToDbf
Shows/hides the menu item DBF File. If the property is set to true, the menu
item will be displayed. If it is set to false, then the menu item will be hidden.
By default, this property is set to true.
ShowExportToXml
Shows/hides the menu item XML File. If the property is set to true, the menu
item will be displayed. If it is set to false, then the menu item will be hidden.
By default, this property is set to true.
ShowExportToDif
Shows/hides the menu item Data Interchange Format (DIF) File. If the
property is set to true, the menu item will be displayed. If it is set to false,
then the menu item will be hidden. By default, this property is set to true.
ShowExportToSylk
Shows/hides the menu item Symbolic Link (SYLK) File. If the property is set
to true, the menu item will be displayed. If it is set to false, then the menu
item will be hidden. By default, this property is set to true.
ShowExportToBmp
Shows/hides the menu item BMP Image. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ShowExportToGif
Shows/hides the menu item GIF Image. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ShowExportToJpeg
Shows/hides the menu item JPEG Image. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ShowExportToPcx
Shows/hides the menu item PCX Image. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ShowExportToPng
Shows/hides the menu item PNG Image. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ShowExportToTiff
Shows/hides the menu item TIFF Image. If the property is set to true, the
menu item will be displayed. If it is set to false, then the menu item will be
hidden. By default, this property is set to true.
ShowExportToMetafil Shows/hides the menu item Windows Metafile. If the property is set to true,
e
the menu item will be displayed. If it is set to false, then the menu item will
be hidden. By default, this property is set to true.
ShowExportToSvg
Shows/hides the menu item Scalable Vector Graphics (SVG) File. If the
property is set to true, the menu item will be displayed. If it is set to false,
then the menu item will be hidden. By default, this property is set to true.
ShowExportToSvgz
Shows/hides the menu item Compressed SVG (SVGZ) File. If the property is
2003-2013 Stimulsoft
93
Stimulsoft Reports
set to true, the menu item will be displayed. If it is set to false, then the
menu item will be hidden. By default, this property is set to true.
9.5.8
Printing
With this group of properties one can modify printing options. This group is represented by the
following properties.
9.5.9
Name
Description
PrintAutoPag
eOrientation
PrintAllowTo
Pdf
Shows/hides the menu item Print to PDF in the report printing dialog box. If the
property is set to true, the menu item will be displayed. If it is set to false, then the
menu item will be hidden. By default, this property is set to true.
PrintAllowTo
Html
Shows/hides the menu item Print to HTML in the report printing dialog box. If the
property is set to true, the menu item will be displayed. If it is set to false, then the
menu item will be hidden. By default, this property is set to true.
Interface
With this group of properties one can modify interface options. This group is represented by the
following properties.
Name
Description
Width
Sets the width of the component. Width units are defined in the Unit class. The following
values are available: in pixels - Unit.Pixel(), in points - Unit.Point()) in per cent - Unit.
Percentage().
Height
Sets the height of the component. Height units are defined in the Unit class. The
following values are available: in pixels - Unit.Pixel(), in points - Unit.Point()) in per
cent - Unit.Percentage().
Theme
Backgrou
ndColor
Sets the background color of the report viewer. The default value if the background is
Color.White.
2003-2013 Stimulsoft
10
94
VB.NET:
Dim Report As StiReport = New StiReport()
Report.Load("report.mrt")
StiWebViewerFx1.Report = Report
If the report was not rendered before showing, then the WebViewerFx component renders it
automatically. Loading a report after loading the viewer is done using the OnGetReport event. After
subscription to this event, it will occur each time when the viewer needs a report. In other words, after
loading WebViewerFx requests the report from the server and, if the subscription to the OnGetReport
event is done, then, in this event, the report can be assigned to the designer. Below is a code example,
using the OnGetReport event:
protected void StiWebViewerFx1_GetReport(object sender, StiWebViewerFx.
StiOnGetReportEventArgs e)
{
StiReport report = new StiReport();
report.Load("D:\\SimpleList.mrt");
e.Report = report;
}
If the report has not been rendered before being displayed, the WebViewerFx component renders it
automatically.
If it is required to show WebViewerFx to the entire browser window, you can use the following
method:
StiReport report = new StiReport();
2003-2013 Stimulsoft
95
Stimulsoft Reports
report.Load("report.mrt");
StiWebViewerFx1.View(report);
In this case, in the entire region in the current browser window a viewer will be displayed. All other
items are located on the .aspx page will not be displayed.
10.3.1 Connection
The static properties described below belong to the StiWebViewerFxOptions.Connection group and
responsible for connecting the client and server sides:
Name
Description
ClientRequestTimeout
property sets time (in seconds) that the client part will wait the response
from the server side. The default value is 10 seconds.
ClientRepeatCount
property sets the number of repeats of requests of the server side to the
client side, when getting errors of obtaining data. The default value is 2
repeats.
RelativeUrls
property allows using the relative Url. If the RelativeUrls is set to false,
then the absolute Url is used. If the RelativeUrls is set to true, then the
relative Url is used. By default, the value is set to false. A sample of the
absolute and relative Urls is shown below:
http://localhost:4444/WebViewerDemo/WebViewer.aspx
is
an
absolute Url, the RelativeUrls property is set to false;
/WebViewerDemo/WebViewer.aspx is a relative Url, the RelativeUrls
2003-2013 Stimulsoft
96
10.3.2 Zooming
The group of static properties Zoom has one StiZoomMode static property. Depending on the values
of this property it is possible to set report template zoom. This property has the following values:
PageWidth, PageHeight, OnePage, Zoom25, Zoom50, Zoom75, Zoom100, Zoom150, Zoom200.
Name
Description
Default
PageWidth
Value sets zoom by Page Width. So the width of the report template
matches the width of the web viewer window.
OnePage
Value sets zoom by One Page. So the entire page of the report template
fits in the window of the web viewer.
TwoPages
Value sets zoom by Two Pages. So two report pages will be shown by
width and height in the WebViewerFx.
Zoom25,
Zoom50, Value sets zoom level of the report template which is 25%, 50%, 75%,
Zoom75,
Zoom100, 100%, 150%, 200%.
Zoom150, Zoom200
Description
ShowZoom
ShowPrintButton
ShowOpenButton
2003-2013 Stimulsoft
97
Stimulsoft Reports
ShowPageDeleteButto
n
ShowPageSizeButton
ShowBookmarksButto
n
ShowEditButton
ShowFirstPageButton
2003-2013 Stimulsoft
98
ShowLastPageButton
the
the
the
the
10.4
Properties
The properties of WebViewerFx are described below:
The ServerTimeout property is used to define time of storing a report in the server cache. By
default, this property is set to "00:10:00", this means that the report is stored 10 minutes in the server
cache and then it is removed.
The Background property is used to change the background color. By default, this property is set to
White, this means that the background color is white. It is also possible to set any color in the
2003-2013 Stimulsoft
99
Stimulsoft Reports
The Localization property is used to specify the ability to localize the WebViewerFx UI in any of 26
languages available. The Localization property should be set to the value. The value is the .xml file in
the Localization folder of the root directory in the project). By default, this property is set to "en", this
means that the UI is localized in English. A code sample for setting the Localization property of the
WebViewerFx UI to English language ("en") is shown below:
<cc1:StiWebDesigner ID="StiWebViewerFx1" runat="server" Localization="ru"
/>
The ImageQuality property is used to change the quality of images in the report. depending on the
value of this property it is possible to change the image file size and image quality. If the
ImageQuality property is set to Low, then the file size and quality will be low. If the ImageQuality
property is set to Normal, then the file size and quality will have optimal ratio between size and quality.
If the ImageQuality property is set to High, then the file size and quality will be the highest.
The ThemeName property is used to change the style the theme of the WebViewerFx. If the
ThemeName property is set to Blue, then the style of the viewer will be as shown on the picture below:
2003-2013 Stimulsoft
100
If the ThemeName property is set to Silver, then the style of the viewer will look as shown on the
picture below:
If the ThemeName property is set to Black, then the style of the viewer will look as shown on the
picture below:
2003-2013 Stimulsoft
101
Stimulsoft Reports
2003-2013 Stimulsoft
102
As seen in the picture above the Html format is shown in the list of formats, and this means that the
ShowExportToHtml property is set to true. If the set this property to false (code below):
<cc1:StiWebViewerFx ID=" StiWebViewerFx1" runat="server"
ShowExportToHtml="False" />
then the HTML format will not be shown in the list of export formats. The picture below shows a list of
formats without HTML:
2003-2013 Stimulsoft
103
Stimulsoft Reports
10.6 Data
To preview the report data are required. By default, data are taken from the Dictionary of the edited
report. If necessary, they can be overridden. To do this you need to add the handler to the GetDataSet
event. There is a sample code below using what data can be overridden:
2003-2013 Stimulsoft
104
C#:
protected void StiWebDesigner1_GetDataSet(object sender,
StiWebDesigner.StiPreviewDataSetEventArgs e)
{
DataSet data = new DataSet();
data.ReadXml("D:\\Demo.xml");
data.ReadXmlSchema("D:\\Demo.xsd");
e.DataSet = data;
}
VB.NET:
Protected Sub StiWebDesigner1_GetDataSet(ByVal sender As Object, ByVal
e As StiWebDesigner.StiPreviewDataSetEventArgs)
Dim data As DataSet = New DataSet()
data.ReadXml("D:\\Demo.xml")
data.ReadXmlSchema("D:\\Demo.xsd")
e.DataSet = data
End Sub
As seen from code, data are taken from XML and XSD files. The same way exists for other data
sources.
11
105
Stimulsoft Reports
Also, there is another way to show a report instead of placing Viewer.Fx on the scene of a Flex
application:
var report: StiReport = new StiReport();
report.loadDocumentFromString(documentString);
report.showDialog();
2003-2013 Stimulsoft
106
StiOptions.viewer.toolbar.showOpenButton = false;
StiOptions.viewer.toolbar.showSaveButton = false;
StiOptions.viewer.toolbar.showThumbnailsButton = false;
StiOptions.viewer.toolbar.showBookmarksButton = false;
StiOptions.viewer.toolbar.showFindButton = false;
In other words each button has the show function. This function has two values: true or false. The
default value of this function is true.
The list of available buttons
On the toolbar:
StiOptions.viewer.toolbar.showPrintButton - Print button;
StiOptions.viewer.toolbar.showOpenButton - Open button;
StiOptions.viewer.toolbar.showSaveButton - Save button
StiOptions.viewer.toolbar.showBookmarksButton - Bookmark button;
StiOptions.viewer.toolbar.showThumbnailsButton - Thumbnails button;
StiOptions.viewer.toolbar.showFindButton - Find button;
StiOptions.viewer.toolbar.showCloseButton - Close button.
On the Navigation toolbar:
StiOptions.viewer.toolbar.showFirstPageButton - First Page button;
StiOptions.viewer.toolbar.showPreviousPageButton - Previous Page button;
StiOptions.viewer.toolbar.showGoToPageButton - GoToPage button;
StiOptions.viewer.toolbar.showNextPageButton - Next Page button;
StiOptions.viewer.toolbar.showLastPageButton - Last Page button.
On the View Page toolbar:
StiOptions.viewer.toolbar.showPageViewModeSingleButton - Single Page button;
StiOptions.viewer.toolbar.showPageViewModeContinuousButton - Continuous Page button;
StiOptions.viewer.toolbar.showPageViewModeMultipleButton - Multiple Page button.
Also it is possible to disable the Zoom panel, see the following:
StiOptions.viewer.toolbar.showZoom = false
12
2003-2013 Stimulsoft
107
Stimulsoft Reports
two parts are assembled into a single dll library and presented as a component.
C#:
protected void Page_Load(object sender, EventArgs e)
{
StiReport report = new StiReport();
StiWebDesignerSL1.Report = myReport;
}
For loading a report in the Web designer, the method of calling can be slightly modified:
C#:
protected void Page_Load(object sender, EventArgs e)
{
StiReport report = new StiReport();
report.Load("D:\\SimpleList.mrt");
StiWebDesignerSL1.Design(report);
}
2003-2013 Stimulsoft
108
or, as a way, the previously loaded report is assigned to the designer. In this case designer loading is
done with this report. See the code below:
protected void Button1_Click(object sender, EventArgs e)
{
StiReport report = new StiReport();
report.Load("D:\\SimpleList.mrt");
StiWebDesignerSL1.Report = report;
StiWebDesignerSL1.Design();
}
Loading a report after loading the designer is done using the GetReport event. After adding the
handler to this event, it will occur each time when a report is required for the designer. In other words,
after loading the Web designer requests a report from the server and, if the handler is added to the
GetReport event, then in this event a report can be assigned to the designer. See the code below how
to use the GetReport event:
protected void StiWebDesignerSL1_GetReport(object sender,
StiWebDesignerSL.StiGetReportEventArgs e)
{
StiReport report = new StiReport();
report.Load("D:\\SimpleList.mrt");
e.Report = report;
}
Loading a report from the main menu of the designer. A report can be loaded by selecting the
Open Report menu item. After selecting this menu item the dialog box for specifying a report for
loading will appear. Also the designer supports loading reports and other report items (for example,
images) using Drag&Drop.
2003-2013 Stimulsoft
109
12.4
Stimulsoft Reports
Report Preview
You can preview the report in the window of the Web-designer by selecting the Preview tab in the
designer. The picture below shows tabs of the Web-designer:
Data are required to preview a rendered report. By default, data specified in the Dictionary of the
edited report are taken. If it is necessary, they can be overridden. Below is a sample code with which
overrides the data:
protected void StiWebDesignerSL1_GetPreviewDataSet(object sender,
StiWebDesignerSL.StiPreviewDataSetEventArgs e)
{
DataSet data = new DataSet();
data.ReadXml("D:\\Demo.xml");
data.ReadXmlSchema("D:\\Demo.xsd");
e.PreviewDataSet = data;
}
As can be seen from the code, the data is taken from XML and XSD files. In the same way you can
substitute the data from other data sources.
Description
SaveReportAsPag
eEnabled
OpenReportEnabl
ed
2003-2013 Stimulsoft
110
and can be available for a user. If false then it is disabled and cannot be
available for a user. By default the property is set to true;
CloseEnabled
SavePageAsEnabl
ed
ReportEnabled
DesignerEnabled
OptionsEnabled
12.5.2 Zooming
The properties of the StiWebDesignerSL Zoom panel are described below:
2003-2013 Stimulsoft
111
Stimulsoft Reports
Name
Description
ShowPageViewContin
uousModeButton
ShowSliderZoomContr Property is used to show/hide the Zoom slider. If the ShowZoom property
ol
is set to true, then the Zoom slider will be shown. If the ShowZoom
property is set to false, then the Zoom slider will be hidden. By default,
this property is set to true.
ZoomMode
Is used to change report zoom. This property has the following values:
Default, OnePage, TwoPages, PageWidth:
The Default value sets previously saved zoom of a report in
WebDesignerSL. So, if a report was saved with 37% zoom then, when
opening it next time, 37% zoom of a report showing remains;
The PageWidth value sets zoom by Page Width. So the width of the
report template matches the width of the window of the web designer;
The PageHeight value sets zoom by Page Height. So the height of the
report template matches the height of the window of the web designer;
The OnePage value sets zoom by One Page. So the entire page of the
report template fits in the window of the web designer.
Zoom
12.5.3 Viewer
The group of static StiWebDesignerSLOptions.Viewer. properties allows setting the viewer. The list of
properties is represented below.
Name
ShowMainToolBar
Description
Property is used to show/hide the Tool Bar. If the ShowMainToolBar
property is set to true, then the Tool Bar panel will be shown. If the
ShowMainToolBar property is set to false, then the Tool Bar panel will be
hidden. By default the property is set to true.
2003-2013 Stimulsoft
112
ShowPrintButton
ShowReportOpenButt
on
ShowReportSaveButto
n
ShowPageNewButton
ShowPageDeleteButto
n
ShowBookmarksPanel
ShowToolFindButton
2003-2013 Stimulsoft
113
Stimulsoft Reports
ShowFirstPageButton
ShowPageLastButton
2003-2013 Stimulsoft
114
false, then the Next Page button will be hidden. By default the property is
set to true.
ShowPreviousPageBut
ton
ShowPageViewSingle
ModeButton
ShowPageViewContin
uousModeButton
ShowSliderZoomContr Property is used to show/hide the Zoom slider. If the ShowZoom property
ol
is set to true, then the Zoom slider will be shown. If the ShowZoom
property is set to false, then the Zoom slider will be hidden. By default the
property is set to true.
Zoom
Property is used to change the report zoom in the viewer. This property
can have any value from 0 to 100, where the Zoom value is zoom in
percent.
2003-2013 Stimulsoft
115
Stimulsoft Reports
Now, when running the Web designer, it will be localized in English. For example, we need to change
the browser title. By default, the browser title is the value of the Report Alias property. If the value is
not set then the Report Name is taken. To change the browser title it is necessary to add the code
below to the event:
protected void StiWebDesignerSL1_PreInit(object sender,
StiWebDesignerSL.StiPreInitEventArgs e)
{
e.WebDesignerSL.BrowserTitle = "Stimulsoft";
}
Now, when running the Web designer, Stimulsoft word will be shown as a report title.
When the UseWCFService property is set to true, a user may use the following events:
Stimulsoft.Report.StiOptions.Silverlight.WCFService.WCFRenderReport
The WCFTestConnection event occurs when clicking the Test Connection button;
2003-2013 Stimulsoft
116
Stimulsoft.Report.StiOptions.Silverlight.WCFService.WCFBuildObjects
The WCFBuildObjects event occurs when returning the list tables from the created data source;
Stimulsoft.Report.StiOptions.Silverlight.WCFService.WCFRetrieveColumns
The WCFRetrieveColumns event occurs when returning the list of data columns for the table;
Stimulsoft.Report.StiOptions.Silverlight.WCFService.
WCFOpeningReportInDesigner
The WCFOpeningReportInDesigner event occurs when clicking the Open Report button in the main
menu;
Stimulsoft.Report.StiOptions.Engine.GlobalEvents.SavingReportInDesigner
The WCFExportDocument event occurs when exporting a report by means of the server. In order to
make available a menu with exports in the viewer by means of the server, you must set the
ShowReportSaveToServerButton property to true:
Stimulsoft.Report.StiOptions.Viewer.Elements.
ShowReportSaveToServerButton = true;
13
2003-2013 Stimulsoft
117
Stimulsoft Reports
If the report was not rendered before showing, then the WebViewerSL component renders it
automatically. Also the viewer supports loading reports using the Drag&Drop.
Description
ShowMainToolBar
ShowPrintButton
ShowReportOpenButt
on
ShowReportSaveButto
n
ShowPageNewButton
ShowPageDeleteButto
n
2003-2013 Stimulsoft
118
ShowBookmarksPanel
ShowToolFindButton
2003-2013 Stimulsoft
119
Stimulsoft Reports
Description
ShowFirstPageButton
ShowPageLastButton
ShowPreviousPageBut
ton
13.2.3 Zooming
The properties of the WebViewerSL Zoom panel are described below:
Name
Description
ShowPageViewSingle
ModeButton
ShowPageViewContin
uousModeButton
2003-2013 Stimulsoft
120
Continuous
button
will
be
shown.
If
the
ShowPageViewContinuousModeButton property is set to false, then the
Continuous button will be hidden. By default the property is set to true.
ShowPageViewMultipl Property is used to show/hide the Multiple
eModeButton
ShowPageViewMultipleModeButton property is
Multiple
Pages
button
will
be
ShowPageViewMultipleModeButton property is
Multiple Pages button will be hidden. By default
true.
ShowSliderZoomContr Property is used to show/hide the Zoom slider. If the ShowZoom property
ol
is set to true, then the Zoom slider will be shown. If the ShowZoom
property is set to false, then the Zoom slider will be hidden. By default the
property is set to true.
ZoomMode
Is used to change report zoom. This property has the following values:
Default, OnePage, TwoPages, PageWidth.
The Default value sets previously saved zoom of a report in
WebViewerSL. So, if a report was saved with 37% zoom then, when
opening it next time, 37% zoom of a report showing remains;
The PageWidth value sets zoom by Page Width. So the width of the
report template matches the width of the window of the web designer;
The OnePage value sets zoom by One Page. So the entire page of the
report template fits in the window of the web viewer;
The TwoPages value sets zoom by Two Pages. So two pages of a
report fit by height and width the window of the WebViewerSL.
Zoom
Property is used to change the report zoom in the viewer. This property
can have any value from 0 to 100, where the Zoom value is zoom in
percent.For example, if the Zoom property is set to 70, the zoom in the
viewer will be equal to 70 percent.
2003-2013 Stimulsoft
121
Stimulsoft Reports
2003-2013 Stimulsoft
122
As can be seen from the picture above, the HTML format is displayed in the list of formats that
corresponds to the ShowHtmlButton property set to true. If you set this property to false:
<cc1:StiWebViewerSL
="False" />
ID="StiWebViewerSL1"
runat="server"
ShowHtmlButton
then the HTML will not be displayed in the list of formats for exporting. The picture below shows a list
of formats for exporting without the Html format:
2003-2013 Stimulsoft
123
Stimulsoft Reports
14
Description
InterfaceType
UseRelativeUrls
2003-2013 Stimulsoft
124
GlobalizationFile
ImageFormat
CacheMode
Defines for the report generator which report cache to use to store
images and service information. You can choose one of the
following options:
Page
Uses the page cache.
Session
Uses the session cache.
ServerTimeout
ImagesPath
2003-2013 Stimulsoft
125
Stimulsoft Reports
Below is a sample code of connecting data in the method of the OnLoadReport event:
protected void StiMobileDesigner1_GetDataSetOnLoad(object sender,
StiMobileDesigner.StiGetDataSetOnLoadEventArgs e)
{
DataSet data = new DataSet();
data.ReadXml(Server.MapPath(string.Empty) + "\\Data\\Demo.xml");
e.Report.RegData(data);
}
Below is a sample code of connecting data in the method of the OnCreateReport event:
protected void StiMobileDesigner1_GetDataSetOnCreate(object sender,
StiMobileDesigner.StiGetDataSetOnCreateEventArgs e)
{
DataSet data = new DataSet();
data.ReadXmlSchema(Server.MapPath(string.Empty) + "\\Data\\Demo.xsd"
);
data.ReadXml(Server.MapPath(string.Empty) + "\\Data\\Demo.xml");
e.Report.RegData(data);
e.Report.Dictionary.Synchronize();
}
Saving a report
After creating or editing a report template, you can save changes. This can be done using the
OnSaveReport event, assigning a saving method. The following example describes a method to store
the report code to a *.mrt file:
protected void StiMobileDesigner1_SaveReport(object sender,
StiMobileDesigner.StiSaveReportEventArgs e)
{
StiReport report = e.Report;
report.Save("D:\\Result.mrt");
}
15
2003-2013 Stimulsoft
126
15.2 Caching
The StiMobileViewer component can output reports in two modes: 1. Using the caching and 2.
Without caching. If the cashing is not used then it is necessary, when every page refreshing, to get data
from a report and render a report again. When using caching the rendered report is saved in cache on
the server. The next time when the page is refreshed, the previously rendered report is loaded from
cache and its re-rendering is not required. It is important to remember that every report saved in
cache takes the server memory and, if there are a lot of queries to reports, it can be a critical factor.
Therefore, one should choose choose either low requirements to the memory but high requirements to
performance or high requirements to the memory but low requirements to speed. Caching should not
be used if the end user needs a report with actual data when every refreshing. The caching process can
be controlled using the RenderMode, CacheMode, and ServerTimeOut properties. If the caching of a
report is not used then the report that was rendered using the last data when page refreshing will be
printed but not the report that is shown on the current moment. If it is necessary to get the exact copy
of a report form the browser, then it is necessary to use caching.
127
Stimulsoft Reports
For example, if a user goes to the next page of a report then not the whole page of the browser on
what the StiMobileViewer component is placed will be refreshed but only the next page of a report
will be sent to the browser using the post-back query. This increases the convenience of working with
the StiMobileViewer component.
Modes with caching are UseCache and AjaxWithCache.
UseCache
With each refresh in the StiMobileViewer component page reloading from the server occurs, but the
report is not re-rendered but each time is loaded from the cache.
AjaxWithCache
This mode as well as the Ajax mode uses the Ajax technology to output a report and also is used for
refreshing operations of the StiMobileViewer component. However, unlike the Ajax mode, this
AjaxWithCache mode does not re-render the report after each information request on the server. The
report that was earlier saved in cache is used.
2003-2013 Stimulsoft
128
report.Load("MyReport.mrt");
report.Render(false);
Stimulsoft.Report.Mobile.StiReportResponse.ResponseAsPdf(this, report);
In this code the report will be loaded first. Then this report will be rendered. Then the result of the
report rendering will be saved to the stream of a page. The following code saves a report to the Excel
2007 format.
StiReport report = new StiReport();
report.Load("MyReport.mrt");
report.Render(false);
Stimulsoft.Report.Mobile.StiReportResponse.ResponseAsExcel2007(this,
report);
15.4
15.5 Settings
Setting the HTML5 Viewer can be done using properties. Properties of HTML5 Viewer can be divided
into the following groups: Zooming and Toolbar.
15.5.1 Zooming
The Zooming group of properties is represented by one property ZoomPercent. The ZoomPercent
property value will be any number from 2 to 403. This number corresponds to the zooming percentage
of the report in the viewer.
15.5.2 Toolbar
The group of static properties StiMobileViewerOptions.Toolbar allows setting the toolbox of the
HTML5 Viewer.
Name
2003-2013 Stimulsoft
Description
129
Stimulsoft Reports
ShowZoom
ShowPrintButton
ShowSave
ShowBookmarksButton
ShowFirstButton
ShowPreviousButton
ShowNextButton
ShowLastButton
ShowViewMode
ShowAboutButton
ShowInterfaceTypeButt
on
15.6 Properties
The properties of HTML5 Viewer are described below:
The ServerTimeout property is used to define time of storing a report in the server cache. By
2003-2013 Stimulsoft
130
default, this property is set to "00:10:00", this means that the report is stored 10 minutes in the
server cache and then it is removed.
The BackColor property is used to change the background color. By default, this property is set to
White, this means that the background color is white. It is also possible to set any color in the
#rrggbb format and transparent color.
The GlobalizationFile property is used to localize the HTML5 Viewer. To do this, you must specify
the value of the GlobalizationFile property, where the value is .xml file in the folder \Localization of
the root user project. By default, this property is set to "en", which means the English localization.
Below is a sample code where the property is set to "ru", which corresponds to Russian localizations
of HTML5 Viewer:
<cc1:StiWebDesigner ID="StiWebViewerFx1" runat="server" Localization="ru.
xml" />
The ImageQuality property is used to change the quality of images in the report. depending on the
value of this property it is possible to change the image file size and image quality. If the
ImageQuality property is set to Low, then the file size and quality will be low. If the ImageQuality
property is set to Normal, then the file size and quality will have optimal ratio between size and
quality. If the ImageQuality property is set to High, then the file size and quality will be the highest.
2003-2013 Stimulsoft
131
Stimulsoft Reports
As seen in the picture above the HTML format is shown in the list of formats, and this means that the
ShowExportToHtml property is set to true. If the set this property to false (code below):
<cc1:StiMobileViewer
ID="
ShowExportToHtml="False" />
StiMobileViewer"
runat="server"
then the HTML format will not be shown in the list of export formats. The picture below shows a list of
formats without the HTML option:
2003-2013 Stimulsoft
132
As can be seen from the code, the data are taken from the XML and XSD files. The same way, you can
put the data from other data sources.
2003-2013 Stimulsoft
133
16
Stimulsoft Reports
where the JFrameparentFrame is a main Frame of the application. For better showing StiViewerFx, the
parent component must have BoxLayoutManager. For loading and showing the report use the
following method:
viewerfx.getStiViewModel().loadDocumentFile(documentFile,
showProgress);
where the argument documentFile is a file of mdc documents, and the boolean value showProgress
provides the ability to define whether to show the loading progress of the document (if it is set to true
then the process is displayed, if false - it is not displayed.) It is also possible to display a report in the
form of a dialog box, you can use the method:
StiViewerFx viewerfx = new StiViewerFx(parentFrame);
JDialogviewerPopup = viewerfx.createPopup(parentFrame, modal);
viewerPopup.setVisible(true);
where the argument parentFrame is a frame from which the dialog is displayed, and the Boolean value
modal - dialog modality. The method returns JDialog, which subsequently can make the necessary
manipulations, such as resizing, changing dialog parameters, visibility, etc.
134
function. Register is taken into account. Do not use the names of existing built-in functions, methods,
variables, reserved words as true/false/null, etc.
public List<Class> getParametersList() the function class should return a list of classes of
variables used in the custom function.
public Object invoke(List<Object> args) there must be a realization of a custom function.
An example of using on the base of Samples\webfx\. Suppose you need to implement a custom
substring function. In the class my.actions.MyRenderReportAction write the following:
2003-2013 Stimulsoft
135
17
Stimulsoft Reports
17.1 Installation
Installation:
Download and install Java SE version 1.5 or higher (for the version 1.5 jaxb-impl and jaxb-api
libraries are required).
Download and install EclipsePlatform.
Download an archive with jar files on stimulsoft.com.
2003-2013 Stimulsoft
136
In the window opened fill in the Project name (e.g. sti_fx_web, as shown in the picture below). Then
configure the web server, on which the application will run.
2003-2013 Stimulsoft
137
Stimulsoft Reports
138
Apache Tomcat of the correct version from a list. Check Create a new local server as shown on Figure
3, then click Next.
Then define the Tomcat installation directory, in which Apache Tomcat is installed, or in which one
needs to install it, as shown in the picture. If it is not installed, then click Download and Install. After all
fields are specified, click Finish.
2003-2013 Stimulsoft
139
17.4
Stimulsoft Reports
Creating Sample
In order to verify the project and the Tomcat server, create a simple JSP and deploy it on Tomcat. To
do this, one can create a new JSP, by choosing File> New> Other, or one can use the context menu,
right-click the project name in the Project Explorer and select New> JSP file. In the next window (see
the picture) define the directory Web Content, and in the File name write index.jsp. Click Finish to
create pages using the default template.
2003-2013 Stimulsoft
140
Now open the index.jsp and edit it so that it displays the current date. The code page is specified in
the code:
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN">
<%@
page
language="java"
contentType="text/html;
charset=UTF-8"
pageEncoding="UTF-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>stimulsoft reports</title>
</head>
<body>
<%java.util.Date date = new java.util.Date();%>
2003-2013 Stimulsoft
141
Stimulsoft Reports
<h1>
This index.jsp.<br>
<%=date.toString()%>
</h1>
</body>
</html>
Now deploy it on the server. For this one need to use the context menu, right-click the project name,
select Run> Run as> Run on server. Define a previously created server and click Finish.
2003-2013 Stimulsoft
142
As a result, you receive the following (see the picture below). This page will be available from any
browser at http://localhost:8080/{ProjectName} (where the {ProjectName} name of the created
project, in our case sti_fx_web).
2003-2013 Stimulsoft
143
Stimulsoft Reports
Next, open the web.xml for editing, it should look like in Listing 2:
<?xml version="1.0" encoding="UTF-8" ?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/
xml/ns/javaee/webapp_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee"
id="WebApp_ID" version="2.5">
<display-name>sti_webviewer</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- configuration, this parameter indicates the main application directory
-->
<servlet>
<servlet-name>StimulsoftResource</servlet-name>
<servlet-class>com.stimulsoft.web.servlet.StiWebResourceServlet</
servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>StimulsoftResource</servlet-name>
<url-pattern>/stimulsoft_web_resource</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>StimulsoftAction</servlet-name>
<servlet-class>com.stimulsoft.webviewer.servlet.
StiWebViewerActionServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>StimulsoftAction</servlet-name>
2003-2013 Stimulsoft
144
<url-pattern>/stimulsoft_webviewer_action</url-pattern>
</servlet-mapping>
</web-app>
Leave unchanged the remaining web.xml blocks, which defines the servlets required for working. Then,
edit the index.jsp (see the code below).
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN">
<%@
page
language="java"
contentType="text/html;
charset=UTF-8"
pageEncoding="UTF-8" %>
<%@ taglib uri="http://stimulsoft.com/designer" prefix="stidesignerfx" %>
<%@ taglib uri="http://stimulsoft.com/viewer" prefix="stiviewerfx" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Stimulsoft Reports.Fx for Java</title>
</head>
<body>
<h1 align="center">My first report!</h1>
<stidesignerfx:iframe
width="100%" height="90%" align="middle"
styleClass="" frameborder="0" styleId=""
marginheight="4" marginwidth="10" name="stiviewer"
scrolling="no" style="" title=""/>
</body>
</html>
Add taglib directives in the JSP (Listing 5). They will work with custom tags on the page.
<%@ taglib uri="http://stimulsoft.com/designer" prefix="stidesignerfx" %>
<%@ taglib uri="http://stimulsoft.com/viewer" prefix="stiviewerfx" %>
Add a tag <stidesignerfx:iframe/>, an analog of an html tag iframe with the support of all its attributes.
See the following as a result of the application deployment, (see the picture below):
2003-2013 Stimulsoft
145
Stimulsoft Reports
All these are analogs of similar HTML tags, supporting all the attributes. A list of standard attributes is
expanded for displaying the report and setting variables for the report. The report = "SimpleList.mrt"
2003-2013 Stimulsoft
146
attribute opens the report with the name SimpleList.mrt. Variables in the Report can be passed in two
ways:
Set the value of a variableStr attribute as a string in the following format: "Variable1 = value1 &
Variable2 = value2". In this case, two variables Variable1 with a value1 and Variable2 with a value2 in
the report will be passed. For example, you need to edit the index.jsp file to open a report with the
name MyFirstReport.mrt by clicking the button and the MyVar report variable has the stidesignerfx
value (Listing 6).
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html;charset=UTF-8" import="java.util.*" %>
<%@ taglib uri="http://stimulsoft.com/designer" prefix="stidesignerfx" %>
<%@ taglib uri="http://stimulsoft.com/viewer" prefix="stiviewerfx" %>
<html>
<head>
<title>Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<stidesignerfx:button value="Run the report designer" report="MyFirstReport.
mrt" variableStr="MyVar=stidesignerfx" />
</body>
</html>
It is also possible to pass parameters to a report as a Map <String, String>. Redesign our
webpage as follows (Listing 6). In this case, a report with the name MyFirstReport.mrt will be loaded in
a report and two parameters will be passed into it:
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html;charset=UTF-8" import="java.util.*" %>
<%@ taglib uri="http://stimulsoft.com/designer" prefix="stidesignerfx" %>
<%@ taglib uri="http://stimulsoft.com/viewer" prefix="stiviewerfx" %>
<html>
<head>
<title>Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<%
Map<String, String>variableMap= new HashMap<String, String>();
variableMap.put("Variable1", "var1");
variableMap.put("Variable2", "var2");
request.setAttribute("myMap", variableMap);
%>
<stidesignerfx:iframe report="MyFirstReport.mrt" variableMap="myMap"
width="100%" height="100%" align="right"
2003-2013 Stimulsoft
147
Stimulsoft Reports
Data here are passed as a HashMap, this parameter should be set to the request or session, and the
key under which it will be there should be passed to the tag as a variableMap attribute. Applying two
attributes variableMap and variableStr is not allowed.
my.servlet.
package my.servlet;
import java.io.IOException;
import java.util.Properties;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import
import
import
import
import
import
my.actions.MyLoadAction;
my.actions.MyLoadDataAction;
my.actions.MyLocalizationAction;
my.actions.MyMailAction;
my.actions.MyRenderReportAction;
my.actions.MySaveAction;
import com.stimulsoft.base.exception.StiException;
import com.stimulsoft.flex.StiFlexConfig;
/**
* Application initialization.
*/
public class ApplicationInitializer implements ServletContextListener {
@Override
public void contextInitialized(final ServletContextEvent event) {
try {
// configuration application
StiFlexConfig stiConfig = initConfigWithoutDir();
//
--------------------------------------------------------// need to override the standard methods
// another comment
2003-2013 Stimulsoft
148
stiConfig.setLoadClass(MyLoadAction.class);
stiConfig.setSaveClass(MySaveAction.class);
stiConfig.setLoadDataClass(MyLoadDataAction.class);
stiConfig.setMailAction(MyMailAction.class);
stiConfig.setLocalizationAction(MyLocalizationAction.
class);
stiConfig.setRenderReportAction(MyRenderReportAction.
class);
//
--------------------------------------------------------StiFlexConfig.init(stiConfig);
// set variable in servlet context attribute
// Map<String, String> myVariableMap = new HashMap<String,
String>();
// myVariableMap.put("Variable1", "myVariableMap");
// event.getServletContext().setAttribute("myMap",
myVariableMap);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public void contextDestroyed(final ServletContextEvent event) {
// empty
}
public StiFlexConfig initConfigWithoutDir() throws StiException,
IOException {
Properties properties = new Properties();
// load your own Properties;
// InputStream inStream = getClass().getResourceAsStream
("RESOURCE_PATH");
// properties.load(inStream);
return new StiFlexConfig(properties);
}
}
In which the main application directory with the file stimulsoft.properties will be defined. In order to
make your own reports saving or loading, it is necessary to specify these classes in a configuration, just
the same wayasyou canspecifyaclassto load datafromxml. Classes are as follow: Listing
MyLoadAction.java
package my.actions;
import java.io.InputStream;
import com.stimulsoft.flex.StiLoadAction;
2003-2013 Stimulsoft
149
Stimulsoft Reports
import com.stimulsoft.flex.utils.StiSaveLoadFileReport;
public class MyLoadAction extends StiLoadAction {
@Override
public InputStream load(String repotrName) {
System.out.println("must override this method to specify your own
load repotr");
return new StiSaveLoadFileReport().getReport(repotrName);
}
}
Listing MySaveAction.java:
package my.actions;
import com.stimulsoft.flex.StiSaveAction;
import com.stimulsoft.flex.utils.StiOperationResult;
import com.stimulsoft.flex.utils.StiSaveLoadFileReport;
public class MySaveAction extends StiSaveAction {
@Override
public StiOperationResult save(String report, String reportName,
boolean newReportFlag) {
System.out.println("must override this method to specify your own
save report");
return new StiSaveLoadFileReport().save(report, reportName,
newReportFlag);
}
}
Listing MyLoadDataAction.java:
package my.actions;
import
import
import
import
java.sql.Connection;
java.sql.DriverManager;
java.sql.SQLException;
java.util.Properties;
import com.stimulsoft.flex.StiLoadDataAction;
public class MyLoadDataAction extends StiLoadDataAction {
@Override
protected String getConnectionString() {
System.out.println("must override this method to specify your own
2003-2013 Stimulsoft
150
connection string");
// return
// "Data Source=localhost\\SQLEXPRESS;Initial Catalog=Mybase;User
ID=UserName; Password=Password;";
return super.getConnectionString();
}
@Override
protected String getUserName() {
System.out.println("must override this method to specify your own
user name");
// return "UserName";
return super.getUserName();
}
@Override
protected String getPassword() {
System.out.println("must override this method to specify your own
password");
// return "Password";
return super.getPassword();
}
@Override
protected String getQuery() {
System.out.println("my Query " + super.getQuery());
return super.getQuery();
}
@Override
public Connection getConnection() throws ClassNotFoundException,
SQLException {
System.out.println("must override this method to specify your own
connection");
boolean overrideByConnectionString = getConnectionString() !=
null
&& getConnectionString().equals("needOverride");
boolean overrideByDataSource = getDataSourceName() != null
&& getDataSourceName().equals("DataSourceOverride");
if (overrideByConnectionString || overrideByDataSource) {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Properties info = new Properties();
info.setProperty("user", "test");
info.setProperty("password", "test");
String connectionString = "jdbc:sqlserver://localhost\
\SQLEXPRESS1:1433;databaseName=mybase;";
return DriverManager.getConnection(connectionString, info);
} else {
return super.getConnection();
}
}
2003-2013 Stimulsoft
151
Stimulsoft Reports
Listing MyLocalizationAction.java:
package my.actions;
import
import
import
import
import
import
import
import
java.io.BufferedInputStream;
java.io.File;
java.io.FileInputStream;
java.io.FileNotFoundException;
java.io.InputStream;
java.util.ArrayList;
java.util.Iterator;
java.util.List;
import
import
import
import
import
com.stimulsoft.base.exception.StiException;
com.stimulsoft.base.utils.StiXmlMarshalUtil;
com.stimulsoft.flex.StiLocalizationAction;
com.stimulsoft.flex.StiLocalizationInfo;
com.stimulsoft.lib.io.StiFileUtil;
2003-2013 Stimulsoft
152
Listing MyMailAction.java:
package my.actions;
import java.util.Properties;
import
import
import
import
import
import
import
import
import
import
import
javax.mail.BodyPart;
javax.mail.Message;
javax.mail.MessagingException;
javax.mail.Multipart;
javax.mail.Session;
javax.mail.Transport;
javax.mail.internet.InternetAddress;
javax.mail.internet.MimeBodyPart;
javax.mail.internet.MimeMessage;
javax.mail.internet.MimeMultipart;
javax.mail.internet.PreencodedMimeBodyPart;
import com.stimulsoft.base.mail.StiMailProperties;
import com.stimulsoft.flex.StiMailAction;
import com.stimulsoft.flex.interactionObject.StiMailData;
/**
* MyMailAction.
*
* @Copyright Stimulsoft
*
*/
public class MyMailAction extends StiMailAction {
@Override
public void init(StiMailData mailData, StiMailProperties mailConf) {
System.out.println("must override this method to specify your own
init");
2003-2013 Stimulsoft
153
Stimulsoft Reports
this.mailData = mailData;
this.mailConf = mailConf;
session = getSession();
}
@Override
protected Session getSession() {
System.out.println("must override this method to specify your own
Session");
Properties props = getProperties();
return Session.getInstance(props);
}
@Override
protected Properties getProperties() {
System.out.println("must override this method to specify your own
mail Properties");
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
return props;
}
@Override
protected Message getMessage() throws MessagingException {
System.out.println("must override this method to specify your own
mail Message");
Message message = new MimeMessage(session);
message.setRecipients(Message.RecipientType.TO, InternetAddress.
parse(mailConf.getFrom()));
message.setRecipients(Message.RecipientType.CC,
InternetAddress.parse(mailConf.getRecipients()));
message.setSubject(mailConf.getSubject());
BodyPart text = getTextPart();
BodyPart body = getFilePart();
Multipart mp = new MimeMultipart();
mp.addBodyPart(text);
mp.addBodyPart(body);
message.setContent(mp);
return message;
}
@Override
protected BodyPart getTextPart() throws MessagingException {
System.out.println("must override this method to specify your own
mail TextPart");
MimeBodyPart text = new MimeBodyPart();
2003-2013 Stimulsoft
154
Listing MyRenderReportAction.java:
package my.actions;
import java.io.IOException;
import com.stimulsoft.base.exception.StiException;
import com.stimulsoft.flex.StiRenderReportAction;
import com.stimulsoft.report.StiReport;
public class MyRenderReportAction extends StiRenderReportAction {
@Override
public StiReport render(StiReport report) throws IOException,
2003-2013 Stimulsoft
155
Stimulsoft Reports
StiException {
System.out.println("must override this method to specify your own
render report");
return report.render();
}
}
http://msdn.microsoft.com/en-us/library/ms378428
An example for a Oracle:
jdbc.driver=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@[HOST][:PORT]:SID;
jdbc.username={myUserName };
jdbc.password={ myUserPassword };
http://www.orafaq.com/wiki/JDBC
An example for a postgresql:
jdbc.driver= org.postgresql.Driver
jdbc.url= jdbc:postgresql://[host]:[port]/[database]
jdbc.username={myUserName };
jdbc.password={ myUserPassword };
http://jdbc.postgresql.org/documentation/80/connect.html
2003-2013 Stimulsoft
18
156
157
Stimulsoft Reports
DTD/xhtml1-strict.dtd">
<%@page import="java.io.FileOutputStream"%>
<%@page import="java.io.FileInputStream"%>
<%@page import="com.stimulsoft.report.utils.data.StiDataColumnsUtil"%>
<%@page import="com.stimulsoft.report.dictionary.StiDataColumnsCollection"%>
<%@page import="com.stimulsoft.report.dictionary.StiDataColumn"%>
<%@page import="com.stimulsoft.report.utils.data.StiSqlField"%>
<%@page import="com.stimulsoft.report.dictionary.dataSources.StiDataTableSource"%>
<%@page import="com.stimulsoft.report.utils.data.StiXmlTable"%>
<%@page import="com.stimulsoft.report.utils.data.StiXmlTableFildsRequest"%>
<%@page import="com.stimulsoft.webdesigner.StiWebDesigerHandler"%>
<%@page import="com.stimulsoft.webdesigner.StiWebDesignerOptions"%>
<%@page
import="com.stimulsoft.report.dictionary.databases.StiXmlDatabase"%>
<%@page import="java.io.File"%>
<%@page import="com.stimulsoft.report.StiSerializeManager"%>
<%@page import="com.stimulsoft.report.StiReport"%>
<%@page language="java" contentType="text/html; charset=utf-8"
pageEncoding="UTF-8"%>
<%@taglib uri="http://stimulsoft.com/webdesigner" prefix="stiwebdesigner"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Stimulsoft Webdesigner for Java</title>
<stiwebdesigner:resources />
<style type="text/css">
</style>
</head>
<body>
<%
final String reportPath = request.getSession().getServletContext().
getRealPath("/reports/Master-Detail.mrt");
final String xmlPath = request.getSession().
getServletContext().getRealPath("/data/Demo.xml");
final String xsdPath = request.getSession().
getServletContext().getRealPath("/data/Demo.xsd");
final String savePath = request.getSession().
getServletContext().getRealPath("/save/");
StiWebDesignerOptions options = new StiWebDesignerOptions();
StiWebDesigerHandler handler = new StiWebDesigerHandler(){
public StiReport getEditedReport(HttpServletRequest
request){
try{
StiReport report = StiSerializeManager.
deserializeReport(new File(reportPath));
report.getDictionary().getDatabases().add(new
StiXmlDatabase("Demo", xsdPath, xmlPath));
return report;
} catch (Exception e){
e.printStackTrace();
}
return null;
}
2003-2013 Stimulsoft
158
159
Stimulsoft Reports
</body>
</html>
Add taglib directives in the JSP. They will work with custom tags on the page.
Listing 3. Custom Stimulsoft tag
<%@ taglib uri="http://stimulsoft.com/webdesigner" prefix="stiwebdesigner"%>
Add a tag <stiwebdesigner:resources /> , tag used to load necessary resources (css & js) for
webdesigner, it havent any attributes, it must be placed inside HTML <head> tag.
Description of webdesigner tag
<stiwebdesigner:webdesigner handler="${handler}" report="${report}" />
This tag contains next attributes:
handler [required] com.stimulsoft.webdesigner.StiWebDesigerHandler object to handle
webdesigner;
options [optional] StiWebdesignerOptions object to customize webdesigner. If not present
default options are used;
designerID [optional] String value identifier of webdesigner HTML element. If more than one
webdesigner present in HTML page each webdesigner must have different identifier.
Description of StiWebDesigerHandler
To handle designer events, class that implement StiWebDesigerHandler must be created and setup in
stiwebdesigner tag. Occured on opening {@link StiReport}.
public StiReport getEditedReport(HttpServletRequest request);
Occurred on loading webdesinger. Here must present implementation of loading report and
population it with Database\Data sources (if required).
public void onOpenReportTemplate(StiReport report, HttpServletRequest request);
Occurred on opening StiReport. Method intended for populate report with Database\Data sources
(if required).
public void onNewReportTemplate(StiReport report, HttpServletRequest request);
Occurred on new StiReport. Method intended for populate report with Database\Data sources (if
required).
In new report if you want to use wizard, you must populate report with datasources.
public void onSaveReportTemplate(StiReport report, String reportName,
HttpServletRequest request);
Occurred on save StiReport. Method must implement saving StiReport.
jdbc.driver={myDriver};
2003-2013 Stimulsoft
160
jdbc.url={myConnectionUrl};
jdbc.username={myUserName };
jdbc.password={ myUserPassword };
http://msdn.microsoft.com/en-us/library/ms378428
An example for a Oracle:
jdbc.driver=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@[HOST][:PORT]:SID;
jdbc.username={myUserName };
jdbc.password={ myUserPassword };
http://www.orafaq.com/wiki/JDBC
An example for a postgresql:
jdbc.driver= org.postgresql.Driver
jdbc.url= jdbc:postgresql://[host]:[port]/[database]
jdbc.username={myUserName };
jdbc.password={ myUserPassword };
http://jdbc.postgresql.org/documentation/80/connect.html
19
2003-2013 Stimulsoft
161
Stimulsoft Reports
<Page x:Class="Demo.RT.BlankPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:viewerRT="using:Stimulsoft.Report.Viewer.RT">
<viewerRT:StiViewerControl x:Name="viewerControl"/>
</Page>
C#:
namespace Demo.RT
{
public sealed partial class BlankPage : Page
{
#region Handlers
async private void BlankPage_Loaded(object sender,
RoutedEventArgs e)
{
StorageFolder folder = Windows.Storage.KnownFolders.
DocumentsLibrary;
StorageFile storageFile = await folder.GetFileAsync(
"SimpleList.mdc");
StiReport report = new StiReport();
await report.LoadDocumentAsync(storageFile);
viewerControl.Report = report;
}
#endregion
public BlankPage()
{
this.InitializeComponent();
this.Loaded += BlankPage_Loaded;
}
}
}
If the report has not been rendered, i.e. the report template is saved (*.mrt, *.mrz, *.mrx), then enter the
following code:
XAML:
<Page x:Class="Demo.RT.BlankPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:viewerRT="using:Stimulsoft.Report.Viewer.RT">
<viewerRT:StiViewerControl x:Name="viewerControl"/>
</Page>
2003-2013 Stimulsoft
162
C#:
namespace Demo.RT
{
public sealed partial class BlankPage : Page
{
#region Handlers
async private void BlankPage_Loaded(object sender,
RoutedEventArgs e)
{
StorageFolder folder = Windows.Storage.KnownFolders.
DocumentsLibrary;
StorageFile storageFile = await folder.GetFileAsync
("SimpleList.mrt");
StiReport report = new StiReport();
await report.LoadAsync(storageFile);
await report.RenderAsync();
viewerControl.Report = report;
}
#endregion
public BlankPage()
{
this.InitializeComponent();
this.Loaded += BlankPage_Loaded;
}
}
}
C#:
2003-2013 Stimulsoft
163
Stimulsoft Reports
namespace Demo.RT
{
public sealed partial class BlankPage : Page
{
#region Handlers
async private void buttonSaveReport_Click(object sender,
RoutedEventArgs e)
{
StiReport report = new StiReport();
StorageFolder folder = Windows.Storage.KnownFolders.
DocumentsLibrary;
StorageFile storageFile = await folder.CreateFileAsync
("Report1.mdc");
await report.SaveDocumentAsync(storageFile);
}
#endregion
public BlankPage()
{
this.InitializeComponent();
this.Loaded += BlankPage_Loaded;
}
}
}
20
Exports
This section describes principles of saving rendered reports to different formats, basic characteristics
of methods for export, export optimization guidelines data structure which are used in export
methods. Stimulsoft Reports supports great many export formats to save rendered reports. Many
clients think that there are too many formats. But when you need to get file of definite format type,
write only one string of code and the format is not PDF, HTML or RTF, only Stimulsoft Reports may
help. We do not think that too many export formats in our report generator is disadvantage and
continually work on adding new formats. The more exports the better, as they say.
2003-2013 Stimulsoft
Exports
164
165
Stimulsoft Reports
other formats from code: using the ExportDocument method of the StiReport class, and using direct
creating or getting from a collection of services the required export service.
The following code id used to export reports to PDF. The PDF file will be placed in the MyReport.Pdf.
The export parameters can be passed using the StiPdfExportSettings object type. This class is
described in the description of the PDF format. If there is no need to change export parameters then it
is possible to use the short code line:
report.ExportDocument(StiExportFormat.Pdf, "MyReport.Pdf");
In this case the export parameters are not passed and the report generator will use parameters which
are set by default for each export. Besides, the result of export can be placed in the stream. For
example:
MemoryStream stream = new MemoryStream();
report.ExportDocument(StiExportFormat.Pdf, stream);
Notice: The ExportDocument method does not call the Render method automatically. Before calling
the ExportDocument method it is necessary to render a report or load a previously rendered report.
As you can see, no services in examples were not created and samples contain simple code. All work
by creating services and checking parameters can be done using the ExportDocument method.
The code above requires connection the following namespaces from assemblies Stimulsoft.Reports.
dll:
Stimulsoft.Report
2003-2013 Stimulsoft
Exports
Formats
166
Description
Formats which are used for representing documents and allows for easy viewing and printing:
PDF
XPS
Html
HtmlTable
HtmlSpan
HtmlDiv
Mht
Text
export to Text.
Rtf
RtfTable
export to Rich Text Format using the Rtf Table element, to create
a report structure.
RtfFrame
export to Rich Text Format using the Rtf Frame element, to create
a report structure.
RtfWinWord
RtfTabbedText
Word2007
Odt
Excel
ExcelXml
export to Microsoft Excel Xml. The file is created using the Xml.
This format is supported starting with Microsoft Office 2003.
Excel2007
2003-2013 Stimulsoft
167
Stimulsoft Reports
Csv
Dbf
export to dBase/FoxPro.
Xml
Dif
Sylk
ImageGif
export to GIF.
ImageBmp
export to BMP.
ImagePcx
export to PCX.
ImagePng
export to PNG.
ImageTiff
export to TIFF.
ImageJpeg
export to JPEG.
ImageEmf
If you exported from the WinForms Viewer, then you should notice, than for each export the special
form for setting parameters of export is shown. This form can be called from the code. The code
below how to do it for the export to the PDF:
service.Export(report, "MyReport.pdf");
This code will call the dialog form for setting parameters of export. If a user clicks "OK", then the file
will be created. If to click the "Cancel" button, then the file creation will be interrupted.
Notice: The name of the method for the report export with dialog forms differs from the name of
the export method without parameters.
2003-2013 Stimulsoft
Exports
168
The export service of a report contains yet another ability. The report can be sent via Email. For
example:
bool sendEMail = true;
service.Export(report, "MyReport.pdf", sendEMail);
This code will call the dialog form for setting parameters of reports, and if a user clicks "OK", then the
reporting tool will call the Email client and will create a new Email letter, the exported report will be
attached to the Email letter. The code above requires connection of the following names from the
Stimulsoft.Report.dll assemblies:
Stimulsoft.Report
Stimulsoft.Report.Export
2003-2013 Stimulsoft
169
Stimulsoft Reports
20.3.1 PDF
PDF (Portable Document Format) is a file format created by Adobe Systems for document exchange
used to create electronic editions using the Adobe Acrobat package. The PDF format is a file text
format that is used to publish documents on any platform and OS. The PDF document contains one or
more pages. Each page may contain any components: text, graphic and illustrations, information, that
provides navigation across the document.
Export to PDF is based on the "Adobe Portable Document Format, Version 1.3, second edition", using
some elements of latest format specifications.
By default all embedded fonts are optimized. Characters which are not used in a report are excluded. It
allows decreasing the size of a file. But, for correct work of the editable field, the font should be
complete. Therefore, for fonts, which are used in editable fields, optimization is not done. This
increases the output file size. If Asian languages are used, the file size can be 15-20mb.
If by some reasons the font optimization is not working correct it can be forcibly disabled using the
static property:
StiOptions.Export.Pdf.ReduceFontFileSize = false;
20.3.1.2 Digital Signature
Digital signature is a requisite of an electronic document used to protect this document from
2003-2013 Stimulsoft
Exports
170
falsification. This document is a result of cryptographic conversion of information using the closed key
of the electronic signature and allows identifying the owner of the certificate of the key of the signature.
Digital signatures are often used to implement electronic signatures
The StiPdfExportSettings class is used to control digital signature. It has the following properties:
public
public
public
public
bool UseDigitalSignature
bool UseLocalMachineCertificates
bool GetCertificateFromCryptoUI
string SubjectNameString
By default:
UseDigitalSignature = false;
UseLocalMachineCertificates = true;
GetCertificateFromCryptoUI = true;
SubjectNameString = string.Empty;
20.3.1.3 Encryption
A PDF document can be encoded to protect the content from unauthorized access. A user may set the
following parameters of encryption:
User password;
Owner password;
Access permission;
Key length.
2003-2013 Stimulsoft
171
Stimulsoft Reports
Using the StiPdfExportSettings class it is possible to set the encryption parameters from code. The
following properties of this class are used:
public
public
public
public
string PasswordInputUser
string PasswordInputOwner
StiUserAccessPrivileges UserAccessPrivileges
StiPdfEncryptionKeyLength KeyLength
An example of using:
StiReport report = new StiReport();
report.Load("c:\\test.mrt");
report.Render(false);
StiPdfExportSettings settings = new StiPdfExportSettings();
settings.PasswordInputUser = "user";
settings.PasswordInputOwner = "owner";
settings.UserAccessPrivileges = StiUserAccessPrivileges.PrintDocument;
settings.KeyLength = StiPdfEncryptionKeyLength.Bit128;
report.ExportDocument(StiExportFormat.Pdf, "c:\\test.pdf", settings);
To enable the export of editable fields it is necessary to set the static property
2003-2013 Stimulsoft
Exports
172
StiOptions.Export.Pdf.AllowEditablePdf = true;
The export parameters of the PDF export are described in the StiPdfExportSettings class. The
description of all class properties are in the table below.
Name
Type
Description
ImageQuality
float
image quality; may have values from 0.0 (the lowest quality) to
1.0 (the highest quality); by default 0.75
ImageResolution
float
EmbeddedFonts
bool
embed font files into the PDF file; is true then all fonts are
embedded into the file and this file will have the same look on
any computer (there is no need to embed additional fonts); if
false then fonts are not embedded; by default true
StandardPdfFonts
bool
Compressed
bool
UseUnicode
bool
ExportRtfTextAsImage bool
PasswordInputUser
string
PasswordInputOwner
string
2003-2013 Stimulsoft
173
Stimulsoft Reports
UserAccessPrivileges
enum
(see
Encryption);
by
KeyLength
enum
key
length
(see
Encryption);
StiPdfEncryptionKeyLength.Bit40
UseDigitalSignature
bool
GetCertificateFromCry
ptoUI
bool
SubjectNameString
string
UseLocalMachineCerti
ficates
bool
CreatorString
string
KeywordsString
string
ImageCompressionMe enum
thod
by
default
default
If the UseUnicode is used then, for Acrobat Reader 5.0, it is necessary to use the Embedded fonts =
true. If the UseUnicode + encoding is used, then it is necessary to use the Embedded fonts = true.
The following should be done to compress file:
enable Compressed;
disable Embedded fonts;
if Embedded fonts is required then enable the ReduceFontFileSize.
Except the StiPdfExportSettings class, parameters of export to PDF are also set using the static
properties. All properties are described in the table below. To access to export properties it is
necessary to add the StiOptions.Export.Pdf... prefix.
For example, StiOptions.Export.Pdf.
DivideSegmentPages.
Name
DivideSegmentPages
Type
bool
Description
divide segmented pages into separate pages; if false then are
2003-2013 Stimulsoft
Exports
Name
Type
174
Description
exported "as is" without dividing; by default true
ConvertDigitsToArabic
bool
ArabicDigitsType
enum
ReduceFontFileSize
bool
AllowEditablePdf
bool
AllowImageComparer
bool
AllowImageTransparency
bool
AllowInheritedPageResou
rces
bool
AllowExtGState
bool
CreatorString
string
KeywordsString
string
20.3.2 XPS
XPS (XML Paper Specification) is the open graphic format of fixed page layout on the base XML (more
precisely XAML-based) used to store printed output as electronic documents. This format was
developed by Microsoft as alternative to the PDF format.
The XPS document format consists of structured XML markup that defines the layout of a document
and the visual appearance of each page, along with rendering rules for distributing, archiving,
rendering, processing and printing the documents. The markup language for XPS is a subset of XAML
that allows including vector graphic elements, using XAML to mark up the WPF-primitives.
The XPS is a ZIP-archive that contains the files which make up the document. The archive includes page
2003-2013 Stimulsoft
175
Stimulsoft Reports
mark up (one file per each page of a document), text, embedded fonts, raster images, 2D vector
graphics and other information.
The export parameters of the XPS export are described in the StiXpsExportSettings class. The
description of all class properties are in the table below.
Name
Type
Description
ImageQuality
float
ImageResolution
float
Besides the StiXpsExportSettings class, the parameters of export to XPS are also set using the static
properties. All properties are described in the table below. To access to export properties it is
necessary to add the StiOptions.Export.Xps... prefix. For example, StiOptions.Export.Xps.
ReduceFontFileSize.
Name
Type
Description
ReduceFontFileSize
bool
AllowImageComparer
bool
AllowImageTransparency
bool
2003-2013 Stimulsoft
Exports
176
The export parameters of the PPT export are described in the StiPpt2007ExportSettings class. The
description of all class properties are in the table below.
Name
Type
Description
ImageQuality
float
ImageResolution
float
Besides the StiPpt2007ExportSettings class, the parameters of the export to PPT are also set using the
static properties. All properties are described in the table below. To access to export properties it is
necessary to add the StiOptions.Export.Ppt2007... prefix. For example, StiOptions.Export.Ppt2007.
ReduceFontFileSize.
Name
AllowImageComparer
20.4
Type
bool
Description
use the image comparer, e.g. replace image duplicates (see
Common export settings); if false then an image is exported
"as is"; by default true
Web Documents
There are two formats HTML (HyperText Markup Language), HTML5 and MHTML (MIME HTML) are
described in this chapter. The first and second formats are used for web page layout. The second
format is a web page archive format used to bind resources together with the HTML code into a single
file.
20.4.1 HTML
HTML (HyperText Markup Language) is the predominant markup language for Web pages. The
majority of web pages are created using the HTML language. The HTML language is interpreted by
browser and shown as a document. HTML is a tag language of the document layout. It provides a
means to describe the structure of text-based information in a document by denoting certain text as
links, headings, paragraphs, lists, etc. Elements are the basic structure for HTML markup. Elements have
two basic properties: attributes and content. Each attribute and each element's content has certain
restrictions that must be followed for a HTML document to be considered valid. An element usually has
a start tag (e.g. <element-name>) and an end tag (e.g. </element-name>).
2003-2013 Stimulsoft
177
Stimulsoft Reports
The export parameters of the HTML export are described in the StiHtmlExportSettings class. The
description of all class properties are in the table below.
Name
Type
Description
Zoom
double
ImageFormat
ImageFormat
ExportMode
StiHtmlExportMode
ExportQuality
StiHtmlExportQuality
Encoding
Encoding
file encoding;
Encoding.UTF8
AddPageBreaks
bool
BookmarksTreeWidth
int
ExportBookmarksMode
StiHtmlExportBookmarksMode
UseStylesTable
bool
by
default
Except the StiHtmlExportSettings class parameters of export to HTML are set using the static
properties. All properties are described in the table below. To access to export properties it is
necessary to add the StiOptions.Export.Html... prefix. For example, StiOptions.Export.Html.
ConvertDigitsToArabic.
2003-2013 Stimulsoft
Exports
Name
Type
178
Description
ConvertDigitsToArabic
bool
ArabicDigitsType
enum
AllowImageComparer
bool
ForceWysiwygWordwrap
bool
ReplaceSpecialCharacters
bool
change symbols '<', '>', '&', ' " ' on < > &
" by default true
20.4.2 MHT
MHTML (MIME HTML) is a web page archive format used to bind resources which are typically
represented by external links (such as images, Flash animations, Java applets, audio files) together with
HTML code into a single file. This file is a web archive and has the .mht extension. The content of a
file is written as an Email message using the MIME standard: in the beginning of a file the HTML file is
written. Then all resources in the base64 encoding with headers are written. Internet Explorer, Opera,
Microsoft Word can work with the MHTML format.
The export parameters of the MHT export are described in the StiMhtExportSettings class. The
description of all class properties are in the table below.
Name
Type
Description
Zoom
double
ImageFormat
ImageFormat
ExportMode
StiHtmlExportMode
ExportQuality
StiHtmlExportQuality
Encoding
Encoding
AddPageBreaks
bool
2003-2013 Stimulsoft
179
Stimulsoft Reports
Name
Type
Description
BookmarksTreeWidth
int
ExportBookmarksMode
20.5.1 TXT
Text file (TXT) is a kind of computer file that is structured as a sequence of lines. A text file exists
within a computer file system. The end of a text file is often denoted by placing one or more special
characters, known as an end-of-file marker, after the last line in a text file.
Text files are commonly used for storage of information.
The export parameters of the TXT export are described in the StiTxtExportSettings class. The
description of all class properties are in the table below.
Name
Type
Description
Encoding
Encoding
DrawBorder
bool
BorderType
StiTxtBorderType
KillSpaceLines
bool
KillSpaceGraphLines
bool
PutFeedPageCode
bool
CutLongLines
bool
2003-2013 Stimulsoft
Exports
Name
Type
180
Description
ZoomX
float
ZoomY
float
Static properties of export to TXT are shown on the table below. To access to export properties it is
necessary to add the StiOptions.Export.Txt... prefix. For example, StiOptions.Export.Txt.
ColumnWidths.
Name
Type
Description
ColumnWidths
string
forcibly set the text column width (the list through the
semicolon); if a row is empty then the column width is not
changed; by default empty string
UseFullTextBoxWidth
bool
use all text box width for a text; in this case if the text is laid
on a border, then the border is erased in this place; if false,
then when drawing a text, one blank space on the right is
always left for correct drawing borders; by default false
UseOldMode
bool
use the old mode of the text export; this property is left for
keeping compatibility with old versions; by default false
UseFullVerticalBorder
bool
UseFullHorizontalBorder bool
CheckBoxTextForTrue
string
CheckBoxTextForFalse
string
20.5.2 RTF
Rich Text Format (RTF) is a free document file format developed by Microsoft for cross-platform
document interchange. The first version of the RTF standard appeared in 1987. Since that time format
specification was changed and added. RTF-documents are supported by many text editors.
The export parameters of the RTF export are described in the StiRtfExportSettings class. The
description of all class properties are in the table below.
2003-2013 Stimulsoft
181
Stimulsoft Reports
Name
Type
Description
ImageQuality
float
ImageResolution
float
UsePageHeadersAndFooters
bool
ExportMode
enum
CodePage
int
Except the StiRtfExportSettings class parameters of export to RTF can be set using the static
properties. All properties are described in the table below. To access to export properties it is
necessary to add the StiOptions.Export.Rtf... prefix. For example, StiOptions.Export.Rtf.
UsePageRefField.
Name
Type
Description
UsePageRefField
bool
ConvertDigitsToArabic
bool
ArabicDigitsType
enum
DivideSegmentPages
bool
LineHeightExactly
bool
RemoveEmptySpaceAtBotto
m
bool
LineSpacing
double
RightMarginCorrection
int
2003-2013 Stimulsoft
Exports
Name
Type
182
Description
SpaceBetweenCharacters
int
UseCanBreakProperty
bool
DivideBigCells
bool
divide big cells into smaller ones for easier editing and
scrolling; by default true
The export parameters of the Word 2007 export are described in the StiWord2007ExportSettings
class. The description of all class properties are in the table below.
Name
Type
Description
ImageQuality
float
ImageResolution
float
UsePageHeadersAndFooters
bool
Static properties of export to Word 2007. To access to export properties it is necessary to add the
StiOptions.Export.Word2007...
prefix.
For
example,
StiOptions.Export.Word2007.
DivideSegmentPages.
2003-2013 Stimulsoft
183
Stimulsoft Reports
Name
Type
Description
DivideSegmentPages
bool
AllowImageComparer
bool
LineHeightExactly
bool
RemoveEmptySpaceAtBottom
bool
RightMarginCorrection
int
SpaceBetweenCharacters
int
20.5.4 ODT
Open Document Text (ODT) is the open document for storing documents of the OpenOffice Writer,
which is included into the OpenOffice.org package.
OpenOffice.org is the open package of office applications created as alternative to Microsoft Office.
OpenOffice.org was one of the first what supported the new open OpenDocument. Works on Microsoft
Windows and UNIX systems: GNU/Linux, Mac OS X, FreeBSD, Solaris, Irix.
OpenDocument Format (ODF) is the open file format for storing office documents, including text
documents, spreadsheets, images, data bases, presentations. This format is based on the XML format.
OpenOffice Writer is the text processor and visual HTML editor, included into the OpenOffice. It is open
software (LGPL license). Writer is similar to Microsoft Word and has approximately the same
functionality. Writer allows saving documents in different formats including Microsoft Word, RTF,
XHTML, and OASIS Open Document Format. Starting with the OpenOffice version 2.0, the
OpenDocument Format is the default format for saving documents. File have the .odt extension.
When exporting the report is converted into a single table. The document is easily editable but some
objects can be changed.
The export parameters of the ODT export are described in the StiOdtExportSettings class. The
2003-2013 Stimulsoft
Exports
184
Type
Description
ImageQuality
float
image quality; may have values from 0.0 (the lowest quality) to1.0
(the highest quality); by default 0.75
ImageResolution
float
image resolution, dot per inch; may have any value, by default 100
Static properties of export to ODT. To access to export properties it is necessary to add the
StiOptions.Export.Odt... prefix. For example, StiOptions.Export.Odt.DivideSegmentPages.
Name
Type
Description
DivideSegmentPages
bool
AllowImageComparer
bool
RemoveEmptySpaceAtBottom
bool
20.6 Spreadsheets
This group of exports create spreadsheets. They are exports to both different formats of Microsoft
Excel and to OpenOffice Calc.
20.6.1 Excel
Microsoft Excel is a spreadsheet application written and distributed by Microsoft for Microsoft
Windows. It allows using calculation, graphing tools, pivot tables and a macro programming language
called VBA. So, it is the most popular table processor available for these platforms since version 5 in
1993.
Microsoft Excel up until Excel 2007 version used a proprietary binary file format called Binary
Interchange File Format (BIFF) and .xls file extension. Specification was closed but since 2008 it was
published. Besides, most of Microsoft Excel can read CSV, DBF, SYLK, DIF, and other formats.
2003-2013 Stimulsoft
185
Stimulsoft Reports
The export parameters of the XLS export are described in the StiExcelExportSettings class. The
description of all class properties are in the table below.
Name
Type
Description
ImageQuality
float
ImageResolution
float
UseOnePageHeaderAndFooter bool
ExportDataOnly
bool
ExportPageBreaks
bool
ExportObjectFormatting
bool
ExportEachPageToSheet
bool
Static properties of export to Excel. To access to export properties it is necessary to add the
StiOptions.Export.Excel... prefix. For example, StiOptions.Export.Excel.AllowExportDateTime.
Name
Type
Description
AllowExportDateTime
bool
export date and time; if false then date and time are
exported as text strings; by default false
ColumnsRightToLeft
bool
MaximumSheetHeight
int
RemoveEmptySpaceAtBottom
bool
ShowGridLines
bool
2003-2013 Stimulsoft
Exports
186
The export parameters of the Excel 2007 export are described in the StiExcel2007ExportSettings
class. The description of all class properties are in the table below.
Name
Type
Description
ImageQuality
float
ImageResolution
float
UseOnePageHeaderAndFooter
bool
ExportDataOnly
bool
ExportPageBreaks
bool
ExportObjectFormatting
bool
ExportEachPageToSheet
bool
2003-2013 Stimulsoft
Type
bool
Description
use the image comparer, e.g. replace image
duplicates (see Common export settings); if false
then an image is exported "as is"; by default true
187
Stimulsoft Reports
Name
Type
Description
ColumnsRightToLeft
bool
MaximumSheetHeight
int
RemoveEmptySpaceAtBottom
bool
20.6.3 ODS
Open Document Spreadsheet (ODS) is the opened format to store OpenOffice Calc spreadsheet
documents, that is included into the OpenOffice.org package.
OpenOffice.org is a free package of office applications developed as alternative to Microsoft Office.
The OpenDocument is one of the first what started to support the opened format. it works on
Microsoft Windows and UNIX-like systems: GNU/Linux, Mac OS X, FreeBSD, Solaris, Irix.
OpenDocument Format (ODF) an open document file format for storing and exchanging editable
documents including text documents (such as notes, reports, and books), spreadsheets, drawings,
databases, presentations. The format is based on the XML-format. The standard was jointly developed
by public and various organizations and is available to all and can be used without restrictions.
OpenOffice Calc is the table processor that is included into the OpenOffice and is a free software (LGPL
license). Calc is similar to the Microsoft Excel spreadsheet and functionality of these processors is
approximately equal. Calc allows you to saving documents to various formats, including Microsoft
Excel, CSV, HTML, SXC, DBF, DIF, UOF, SLK, SDC. Starting with version OpenOffice 2.0, for document
storage format by default OpenDocument Format, files are saved with the extension . Ods. Starting
with the OpenOffice version 2.0 for storing documents, by default, the OpenDocument Format is used.
Files are stored with the .ods extension.
The export parameters of the ODS export are described in the StiOdsExportSettings class. The
description of all class properties are in the table below.
Name
Type
Description
ImageQuality
float
image quality; may have values from 0.0 (the lowest quality)
to1.0 (the highest quality); by default 0.75
ImageResolution
float
2003-2013 Stimulsoft
Exports
188
Static properties of export to ODS. To access to export properties it is necessary to add the
StiOptions.Export.Ods... prefix. For example, StiOptions.Export.Ods.AllowImageComparer.
Name
Type
Description
AllowImageComparer
bool
DivideSegmentPages
bool
RemoveEmptySpaceAtBottom
bool
20.7 Data
This is a group of file formats which are used to store table data.
20.7.1 CSV
CSV (Comma Separated Values) is a text format that is used to represent table data. Each string of the
file is one row of the table. The values of each column are separated by the delimiter that depends on
regional settings. The values that contain reserved characters (such as a comma or a new string) are
framed with the double quotes ( ") symbol; if double quotes are found in the value they are
represented as two double quotes in the file.
Notice: Only those data (components) can be exported to the CSV format which are placed on data
bands. If the SkipColumnHeaders property is set to false then, additionally, column headers are
exported as the first row.
The export parameters of the CSV export are described in the StiCsvExportSettings class. The
description of all class properties are in the table below.
Name
Separator
2003-2013 Stimulsoft
Type
string
Description
sets the symbol-separator of a list that is used when exporting;
by default CurrentCulture.TextInfo.ListSeparator
189
Stimulsoft Reports
Encoding
Encoding
SkipColumnHeaders
bool
Static properties of export to CSV. To access to export properties it is necessary to add the
StiOptions.Export.Csv... prefix. For example, StiOptions.Export.Csv.ForcedSeparator.
Name
ForcedSeparator
Type
string
Description
sets the separator forcibly which are used in export; if
the empty string is set then the symbol from export
settings in used; by default - empty string
20.7.2 DBF
The DBF (DataBase File) is the format to store data and it is used as the standard way to store and
pass information. The DBF file consist of a header section for describing the structure of the data in the
file. There are several variations on the .dbf file structure.
Notice: Only data can be exported to the DBF format, in other words only the components, which
are placed on data bands.
The following elements can be specified in the Tag field to control export:
DataType [ : FieldLength [ : DecimalPartLength ] ]
ExportType : "FieldName"
Column: "FieldName" "DataString"
Several elements should be separated with the semicolon. The DataType" element should be only one
and should be placed first, other elements if necessary.
Values of the "DataType" element are shown in the table below. If the data type is not set, then the
string data type is taken by default. The "FieldLength" element sets fixed width of a data field. If the
field width is not set, then the width is taken from the table. For the string type the default width is the
longest string. The "DecimalPartLength" element sets the number of characters after comma. If it is not
set, then the default number is taken.
Data type
int
Description
Numeric
2003-2013 Stimulsoft
Exports
long
Numeric (25 : 0)
Numeric
float
Numeric (15 : 5)
Decimal
double
Decimal
string
Character (auto)
Text
date
Date (8)
Date
190
Description
string : 25
set the column width (25 characters) and cuts all long strings
float
float :10
float :10 : 2
int :10 : 2
Notice: If the integer part of a digit is long and cannot be placed into the specified field, then it is
cut, so data are lost. For example, if the write -12345,678 in the float:8:3 field, then the 2345,678
will be output.
The "ExportType" element indicates for which export the field name is set. The values can be used:
dbf, csv, xml, default. The "FieldName" element indicates the field name in the file (for the DBF
the is automatically cut up to 10 characters). The own name can be specified to each type of export. If
the name for each export is not specified then the name for the default type is taken. For example:
DBF : "Describe" ; XML : "Description" ; default: "Default name"
The "Column" element indicates that the additional field is added to the exported data. The
"FieldName" element indicates the name of a new field. The "DataRow" element indicates the content of
a new field and can be expression. For example
Column: "SortField" "{Products.Categories.CategoryName}"
The export parameters of the DBF export are described in the StiDbfExportSettings class. The
2003-2013 Stimulsoft
191
Stimulsoft Reports
Type
CodePage
Description
StiDbfCodePages
a code page of a
StiDbfCodePages.Default
file;
by
default
20.7.3 XML
XML (eXtensible Markup Language) is a text format that is used to store structured data (in exchange
for existed files of data bases), for exchange of information between programs and also to create on
its base the special markup languages (for example, XHTML), sometimes called dictionaries. XML is the
hierarchical structure that is used to store any data. Visually this structure can be represented as the
tree. XML supports Unicode and other encoding.
Notice: Only those data (components) are exported to the XML format which are placed on data
bands.
The following elements can be specified in the Tag field to control export to XML:
DataType
ExportType : "FieldName"
Column: "FieldName" "DataRow"
Several elements should be separated with the semicolon. The DataType" element should be only one
and should be placed first, other elements if necessary.
Values of the "DataType" element are shown in the table below. If the data type is not set, then the
string data type is taken by default.
Data type
Description
int
Numeric
long
Numeric
float
Decimal
double
Decimal
string
Text
date
Date
The "ExportType" element indicates for which export the field name is set. The values can be used:
dbf, csv, xml, default. The "FieldName" element indicates the field name in the file. The own
name can be specified to each type of export. If the name for each export is not specified then the
2003-2013 Stimulsoft
Exports
192
The "Column" element indicates that additional field is added to the exported data. The "FieldName"
element indicates the name of a new field. The "DataRow" element indicates the content of a new field
and can be expression. For example:
Column: "SortField" "{Products.Categories.CategoryName}"
20.7.4 DIF
DIF (Data Interchange Format) is a text format that is used to exchange sheets between spreadsheets
processors (Microsoft Excel, OpenOffice.org Calc, Gnumeric, StarCalc, Lotus 1-2-3, FileMaker, dBase,
Framework, Multiplan, etc). The only limitation of this format is that the DIF format may contain only one
sheet in one book.
The export parameters of the DIF export are described in the StiDifExportSettings class. The
description of all class properties are in the table below.
Name
Type
Description
ExportDataOnly
bool
Encoding
Encoding
UseDefaultSystemEncoding
bool
20.7.5 SYLK
SYLK (Symbolic Link) format- this text format is used to exchange data between applications,
specifically spreadsheets. Files of SYLK have .slk extension. Microsoft does not publish a SYLK
specification, therefore work with this format in different applications can be different.
Notice: A SYLK file can be written in Unicode and read by some applications but anyway many
applications which do support Unicode writes SYLK files into ANSI but not Unicode. Therefore, symbols
which do not have representation in the system code page will be written as ('?') symbols.
2003-2013 Stimulsoft
193
Stimulsoft Reports
The export parameters of the SYLK export are described in the StiSylkExportSettings class. The
description of all class properties are in the table below.
Name
21
Type
Description
ExportDataOnly
bool
Encoding
Encoding
UseDefaultSystemEncoding
bool
Report Inheritance
There are two ways of report inheritance:
Creation of the basic class of a report;
Creation of the master-report.
In both ways you should create a basic report in the designer that includes all necessary elements. You
may add the following components to the basic reports:
Pages;
Components;
Data sources;
Variables;
Connections.
In order to use the basic report when creating a new report in the designer, you need to add the
following string of a code:
2003-2013 Stimulsoft
Report Inheritance
194
StiReport.ReportType = typeof(Reports.Report);
Then all new reports will be automatically inherited from the basic class. In the second way you need to
use the following code:
StiReport masterReport = new StiReport();
masterReport.Load("d:\\master-detail.mrt");
StiReport report = new StiReport();
report.RegData(dataSet);
report.MasterReport = masterReport.SaveToString();
report.Design();
22
Scripts
Stimulsoft Reports supports a choice of languages for report generation.
2003-2013 Stimulsoft
195
Stimulsoft Reports
default programming language. For example, on the picture below the C# programming language is
the default programming language. To make VB.Net the default programming language simply drag
the StiCSharpLanguage service down one position with the mouse or use the up and down buttons to
re-order the languages.
Scripts
196
Note: The report code is generated in C# or VB.Net programming language. All events and any
another code in this report must be written in the currently selected language.
When rendering reports, compilation of the report class occurs first. After that the compiled report is
executed.
Note: The report code is compiled using the .NET Framework compiler.
Reviewing and Editing the Report Code
To see the report code click the Code tab in the designer. The code will then be displayed:
2003-2013 Stimulsoft
197
Stimulsoft Reports
Any code that you write within the report must be written outside these Regions.
23
Right To Left
By default, components are output from left to right. The Right to Left property allows changing the
mode of showing report items.
If the RightToLeft property is set to Yes, then viewer items and report pages in a viewer window are
displayed from right to left. The code for setting the right to left mode is shown below:
StiOptions.Viewer.RightToLeft = StiRightToLeftType.No;
23.2 Icons
With the help of icons information about the components, settings and tools applied to these
components in the reports is displayed. These icons are filtering, conditions and events of the inherited
report, dynamic collapsing, dynamic sorting, order, quick information. By default, these icons are
displayed in the left to right order in a component, but if necessary, they can be displayed in the right
to left order. It is possible using the properties: ConditionsRightToLeft, EventsRightToLeft,
InheritedRightToLeft,
InteractionCollapsingRightToLeft,
InteractionSortRightToLeft,
OrderAndQuickInfoRightToLeft, FiltersRightToLeft, QuickButtonsRightToLeft. They belong to the
StiOptions.Viewer.Pins class. Consider these features in more detail:
2003-2013 Stimulsoft
Right To Left
198
The mode of displaying the Conditions icon depends on the value of the ConditionsRightToLeft
property. For example, if to place a Condition in the DataBand, then the Conditions icon will be
displayed by default in the lower left corner of this DataBand, because the ConditionsRightToLeft
property is set to false. The picture below shows an example of a report template with the Conditions
icon in the left to right mode:
Set the ConditionsRightToLeft property to true to change the position of the icon:
StiOptions.Viewer.Pins.ConditionsRightToLeft = true;
And then the icon will be displayed in the "right to left" mode, i.e. in the lower right corner of the
DataBand. The picture below shows an example of a report template with the Conditions icon in the
right to left mode:
Change the value of the EventsRightToLeft property to change the location of the Events icon. For
example, if to place an Event in the text component, then the Events bookmark will be displayed by
default in the upper left corner of the text component, because the EventsRightToLeft property is set
to false. The picture below shows an example of a report template with the Events icon in the left to
right mode:
Set the EventsRightToLeft property to true to change the location of the Events icon.
2003-2013 Stimulsoft
199
Stimulsoft Reports
StiOptions.Viewer.Pins.EventsRightToLeft = true;
The picture below shows an example of a report template with the Events icon in the right to left
mode:
The InheritedRightToLeft property is used to change the location of the Inherited icon. By default,
this property is set to false, i.e. the icon appears in the left to right mode. The picture below shows an
example of a report template with the Inherited icon in the left to right mode:
the Inherited icon will appear in the right to left mode (see the picture below):
2003-2013 Stimulsoft
Right To Left
200
Collapsing icons will appear in the right to left mode (see the picture below):
the InteractionSort icon will appear in the right to left mode (see the picture below):
2003-2013 Stimulsoft
201
Stimulsoft Reports
The OrderAndQuickInfoRightToLeft property is used to change the location of the Show Order
icon. By default, this property is set to false, i.e. the icon appears in the left to right mode. The picture
below shows an example of a report template with the Show Order icon in the left to right mode:
the Show Order icon will appear in the right to left mode (see the picture below):
The FiltersRightToLeft property is used to change the location of the Filters icon. By default, this
property is set to false, i.e. the icon appears in the left to right mode. The picture below shows an
example of a report template with the Filters icon in the left to right mode:
2003-2013 Stimulsoft
Right To Left
202
StiOptions.Viewer.Pins.FiltersRightToLeft = true;
the Filters icon will appear in the right to left mode (see the picture below):
The QuickButtonsRightToLeft property is used to change the location of the QuickButtons icon. By
default, this property is set to false, i.e. the icon appears in the left to right mode. The picture below
shows an example of a report template with the Filters icon in the left to right mode:
the QuickButtons icon will appear in the right to left mode (see the picture below):
The picture below shows the left to right order of showing controls in the designer and viewer. If the
FlowDirection property is set to RightToLeft, then controls are shown in the right to left order. See
the code below how to achieve this result.
2003-2013 Stimulsoft
203
Stimulsoft Reports
FlowDirection="RightToLeft"
The picture below shows the right to left order of showing controls in the designer and viewer.
As can be seen from the picture above, the order of showing report pages in the viewer also depends
on the value of the FlowDirection property.
2003-2013 Stimulsoft
Right To Left
24
204
Deployment
Description
Stimulsoft.Base.dll
Stimulsoft.Editor.dll
Stimulsoft.Controls.dll
Stimulsoft.Controls.Win.
dll
Stimulsoft.Report.dll
Stimulsoft.Report.Chart.dll This baseline assembly contains the core of the chart component.
Stimulsoft.Design.dll
Stimulsoft.Report.Win.dll
Stimulsoft.Report.Design.
dll
Stimulsoft.Report.Check.
dll
Stimulsoft.Report.Helper.
dll
Stimulsoft.Database.dll
This dll file is used for creating and editing a connections string. Also
this dll contains QueryBuilder.
Stimulsoft.Report.Web.dll
Demo.exe
Tools:
2003-2013 Stimulsoft
205
Stimulsoft Reports
Configurator.exe
Installer.exe
Browser.exe
Designer.exe
StyleDesigner.exe
ReportChecker.exe
Viewer.exe
Import.CrystalReports.exe
Import.ActiveReports.exe
Import.FastReports.exe
Import.Rdl.exe
Import.
ReportSharpShooter.exe
Import.Rtf.exe
This application is used for converting the RTF (Rich Text Format) files
to the Stimulsoft Reports.Net templates.
Import.XtraReports.exe
Description
Stimulsoft.Base.dll
Stimulsoft.Editor.dll
Stimulsoft.Controls.dll
Stimulsoft.Controls.Wpf.
dll
Stimulsoft.Report.Wpf.dll
2003-2013 Stimulsoft
Deployment
206
Stimulsoft.Report.Wpf.
Design.dll
This assembly contains Visual Studio design-time part for the WPF
viewer and WPF designer.
Stimulsoft.Report.Xbap.dll
Stimulsoft.Report.Xbap.
Design.dll
This assembly contains Visual Studio design-time part for the XBAP
viewer.
Stimulsoft.Report.
WpfDesign.dll
Stimulsoft.Report.Check.
dll
Stimulsoft.Report.Helper.
dll
Stimulsoft.Database.dll
This dll file is used for creating and editing a connections string. Also
this dll contains QueryBuilder.
WPF theme assemblies:
Stimulsoft.Report.Wpf.
BlackTheme.dll
This assembly contains the Black theme for the WPF report viewer and
WPF report designer.
Stimulsoft.Report.Wpf.
Office2003BlueTheme.dll
This assembly contains the Office 2003 Blue theme for the WPF report
viewer and WPF report designer.
Stimulsoft.Report.Wpf.
This assembly contains the Office 2003 Olive Green theme for the WPF
Office2003OliveGreenThem report viewer and WPF report designer.
e.dll
Stimulsoft.Report.Wpf.
Office2003SilverTheme.dll
This assembly contains Office 2003 Silver theme for the WPF report
viewer and WPF report designer.
Stimulsoft.Report.Wpf.
Office2007BlackTheme.dll
This assembly contains Office 2007 Black theme for the WPF report
viewer and WPF report designer.
Stimulsoft.Report.Wpf.
Office2007BlueTheme.dll
This assembly contains Office 2007 Blue theme for the WPF report
viewer and WPF report designer.
Stimulsoft.Report.Wpf.
Office2007SilverTheme.dll
This assembly contains Office 2007 Silver theme for the WPF report
viewer and WPF report designer.
Stimulsoft.Report.Wpf.
Office2010BlueTheme.dll
This assembly contains Office 2010 Blue theme for the WPF report
viewer and WPF report designer.
Demo Applications:
Demo.exe
Tools:
Installer.exe
2003-2013 Stimulsoft
207
Stimulsoft Reports
StyleDesigner.exe
ReportChecker.exe
Import.CrystalReports.exe
Import.ActiveReports.exe
Import.FastReports.exe
Import.Rdl.exe
Import.
ReportSharpShooter.exe
Import.Rtf.exe
This application is used for converting the RTF (Rich Text Format) files
to the Stimulsoft Reports.Net templates.
Import.XtraReports.exe
Description
The baseline assembly of the report generator.
Stimulsoft.Base.dll
Stimulsoft.Editor.dll
Stimulsoft.Controls.dll
Stimulsoft.Controls.Win.dll
Stimulsoft.Report.dll
Stimulsoft.Report.Check.dll
Stimulsoft.Report.Chart.dll
2003-2013 Stimulsoft
Deployment
208
Stimulsoft.Report.Design.
dll
Stimulsoft.Report.Design.
WebViewer.dll
Stimulsoft.Database.dll
This dll is used for creating and editing connections string. Also this
dll contains QueryBuilder.
Stimulsoft.Report.Web.dll
Stimulsoft.Report.WebFx.
dll
Stimulsoft.Report.
WebDesign.dll
Demo application:
Demo.Web.exe
Import.CrystalReports.exe
Installer.exe
Designer.exe
ReportChecker.exe
StyleDesigner.exe
Import.ActiveReports.exe
Import.FastReports.exe
Import.Rdl.exe
This application is used for converting the RTF (Rich Text Format)
files to the Stimulsoft Reports.Net templates.
Import.XtraReports.exe
2003-2013 Stimulsoft
209
24.4
Stimulsoft Reports
Description
Assembly that contains the Web Designer.
Description
The baseline assembly of the report generator.
Stimulsoft.Base.dll
Stimulsoft.Editor.dll
Stimulsoft.Controls.dll
Stimulsoft.Controls.Win.dll
Stimulsoft.Report.dll
Stimulsoft.Report.Check.dll
Stimulsoft.Report.Chart.dll
Stimulsoft.Report.Design.
SLViewer.dll
Stimulsoft.Database.dll
This dll is used for creating and editing connections string. Also this
dll contains QueryBuilder.
Silverlight Assemblies:
Stimulsoft.Base.SL.dll
Stimulsoft.Compression.SL.
dll
Stimulsoft.Controls.SL.dll
2003-2013 Stimulsoft
Deployment
210
based assembly.
Stimulsoft.Report.SL.dll
Stimulsoft.Report.Check.SL.
dll
Stimulsoft.Report.Helper.
SL.dll
Stimulsoft.Report.Viewer.
SL.dll
Stimulsoft.Report.WebSL.
dll
Stimulsoft.Report.
WebDesignSL.dll
Demo.SL
Demo.Web.SL
Designer.SL
Viewer.SL
OptionsHelper.exe
Import.CrystalReports.exe
Installer.exe
Designer.exe
ReportChecker.exe
StyleDesigner.exe
2003-2013 Stimulsoft
211
Stimulsoft Reports
Import.ActiveReports.exe
Import.FastReports.exe
Import.Rdl.exe
This application is used for converting the RTF (Rich Text Format)
files to the Stimulsoft Reports.Net templates.
Import.XtraReports.exe
Description
Assembly which contains Silverlight Reports Designer (Client/Server
version) Asp.Net based control.
Description
Stimulsoft.Base.dll
Stimulsoft.Editor.dll
Stimulsoft.Controls.dll
Stimulsoft.Controls.Win.
dll
Stimulsoft.Report.dll
Stimulsoft.Report.Chart.dll This baseline assembly contains the core of the chart component.
Stimulsoft.Design.dll
Stimulsoft.Report.Win.dll
2003-2013 Stimulsoft
Deployment
212
Stimulsoft.Report.Design.
dll
Stimulsoft.Report.Check.
dll
Stimulsoft.Report.Helper.
dll
Stimulsoft.Database.dll
This dll file is used for creating and editing a connections string. Also
this dll contains QueryBuilder.
Stimulsoft.Report.Web.dll
Stimulsoft.Report.
WebDesign.dll
Stimulsoft.Report.WebFx.
dll
Stimulsoft.Database.Wpf.
dll
This dll is used for creating and editing a connections string. Also this
dll contains QueryBuilder.
Stimulsoft.Report.Design.
SLViewer.dll
Stimulsoft.Database.Wpf.
dll
Stimulsoft.Controls.Wpf.
dll
Stimulsoft.Report.Wpf.dll
Stimulsoft.Report.Wpf.
Design.dll
This assembly contains Visual Studio design-time part for the WPF
viewer and WPF designer.
Stimulsoft.Report.Xbap.dll
Stimulsoft.Report.Xbap.
Design.dll
This assembly contains Visual Studio design-time part for the XBAP
viewer.
Stimulsoft.Report.
WpfDesign.dll
This assembly contains Black theme for the WPF report viewer and
WPF report designer.
Stimulsoft.Report.Wpf.
Office2003BlueTheme.dll
This assembly contains Office 2003 Blue theme for the WPF report
viewer and WPF report designer.
Stimulsoft.Report.Wpf.
This assembly contains Office 2003 Olive Green theme for the WPF
2003-2013 Stimulsoft
213
Stimulsoft Reports
This assembly contains Office 2003 Silver theme for the WPF report
viewer and WPF report designer.
Stimulsoft.Report.Wpf.
Office2007BlackTheme.dll
This assembly contains Office 2007 Black theme for the WPF report
viewer and WPF report designer.
Stimulsoft.Report.Wpf.
Office2007BlueTheme.dll
This assembly contains Office 2007 Blue theme for the WPF report
viewer and WPF report designer.
Stimulsoft.Report.Wpf.
Office2007SilverTheme.dll
This assembly contains Office 2007 Silver theme for the WPF report
viewer and WPF report designer.
Stimulsoft.Report.Wpf.
Office2010BlueTheme.dll
This assembly contains Office 2010 Blue theme for the WPF report
viewer and WPF report designer.
Silverlight Assemblies:
Stimulsoft.Base.SL.dll
Stimulsoft.Compression.
SL.dll
Stimulsoft.Controls.SL.dll
Stimulsoft.Report.SL.dll
Stimulsoft.Report.Check.
SL.dll
This assembly contains core of the Report Checker tool for Silverlight.
Stimulsoft.Report.Helper.
SL.dll
Stimulsoft.Report.
SLDesign.dll
Stimulsoft.Report.Viewer.
SL.dll
Stimulsoft.Report.WebSL.
dll
Stimulsoft.Report.
WebDesignSL.dll
Demo.exe
2003-2013 Stimulsoft
Deployment
214
Demo.Web.exe
Demo.Wpf.exe
Demo.SL
Demo.Web.SL
Tools:
Configurator.exe
Installer.exe
Browser.exe
Designer.exe
StyleDesigner.exe
ReportChecker.exe
Viewer.exe
Import.CrystalReports.exe
Import.ActiveReports.exe
Import.FastReports.exe
Import.Rdl.exe
Import.
ReportSharpShooter.exe
Import.Rtf.exe
This application is used for converting the RTF (Rich Text Format) files
to the Stimulsoft Reports.Net templates.
Import.XtraReports.exe
OptionsHelper.exe
Designer.Wpf.exe
2003-2013 Stimulsoft
215
Stimulsoft Reports
StyleDesigner.Wpf.exe
ReportChecker.Wpf.exe
Designer.SL
Viewer.exe
Viewer.Wpf.exe
Viewer.SL
Description
Stimulsoft_ViewerFx.swc
Stimulsoft_DesignerFx.swc
Description
localization (folder)
This folder contains all localization files. The list of localization files
is indicated automatically when loading the designer or viewer.
config.xml
swfobject.js
playerProductInstall.swf
These files are used for loading the Flash content and Flash player
updates.
designer.html
viewer.html
2003-2013 Stimulsoft
Deployment
216
DesignerFx_PHP.swf
ViewerFx_PHP.swf
index.php
handler.php
localization.php
database_xml
database_mssql.php
database_mysql.php
database_odbc.php
database_oracle.php
database_pg.php
Description
stimulsoft.reports.fx-core2011.1.1000.jar
stimulsoft.reports.fxdesigner-2011.1.1000.jar
This library is used for the report viewer and report designer in a
web application.
stimulsoft.reports.fx-swt2011.1.1000.jar
This library for using the report viewer and report designer in an
swt application.
2003-2013 Stimulsoft
217
Stimulsoft Reports
2003-2013 Stimulsoft
Deployment
218
if (!Directory.Exists(folder)) Directory.CreateDirectory(folder);
report.Compile(compiledReportFile);
}
report.Render(false);
Precompilation of reports updating them. This method is a variation of the previous one. After
updating reports in the application, or if they are not present, or if necessary, start the compilation
process of all reports, which are used in the application. Before compiling the old version assemblies is
removed. Sometimes the process of compiling the report for a given process may take some time.
219
Stimulsoft Reports
Localization files
2003-2013 Stimulsoft
Deployment
220
final application:
Stimulsoft.Report.WebDesignSL.dll
2003-2013 Stimulsoft
221
Stimulsoft Reports
application:
Stimulsoft_ViewerFx.swc
Stimulsoft_DesignerFx.swc
Localization files
2003-2013 Stimulsoft
Deployment
222
2003-2013 Stimulsoft
223
Stimulsoft Reports
supports two type of files: unpacked report (the .mrt file extension) and packed reports (the .mrz file
extension). Packed reports have small file size but it takes much time for saving and loading them. For
loading the previously saved report the following code is required:
C#:
StiReport report = new StiReport();
report.Load("report.mrt");
VB.NET:
Dim Report As StiReport = New StiReport()
Report.Load("report.mrt")
:
C#:
StiReport report = new StiReport();
report.Save("report.mrt");
VB.NET:
Dim Report As StiReport = New StiReport()
Report.Save("report.mrt")
2003-2013 Stimulsoft
Deployment
224
Notice: The report code is completely compatible with C# and VB languages. Therefore, the report
code can be saved and used in the Visual Studio.NET project.
2003-2013 Stimulsoft
225
Stimulsoft Reports
2003-2013 Stimulsoft
Deployment
226
For loading a report from the assembly the following code is used:
C#:
StiReport report = StiReport.GetReportFromAssembly("report.dll");
VB.NET:
Dim Report As StiReport = StiReport.GetReportFromAssembly("report.dll")
Reports, which are loaded from assembly, do not require compilation. It is impossible to edit such
reports in the reports designer.
2003-2013 Stimulsoft
227
Stimulsoft Reports
C#:
StiReport report = new StiReport();
report.Load("report.mrt");
report.CompileStandaloneReport("report.exe", StiStandaloneReportType.
Show);
VB.NET:
Dim Report As New StiReport()
Report.Load("report.mrt")
Report.CompileStandaloneReport("report.exe", StiStandaloneReportType.
Show)
It is important to remember that for working with standalone reports the Stimulsoft Reports libraries
are required. Besides, the report should get all data itself.
2003-2013 Stimulsoft