Beruflich Dokumente
Kultur Dokumente
Table of Contents
Part I Stimulsoft Reports Server API
1 Users
................................................................................................................................... 1
.......................................................................................................................................................... 1
Signing Up
.......................................................................................................................................................... 2
Logging In
.......................................................................................................................................................... 2
Getting User Info
Getting List of Users.......................................................................................................................................................... 3
Changing User Info .......................................................................................................................................................... 4
..........................................................................................................................................................
4
Changing User Passw
ord
Creating New User .......................................................................................................................................................... 5
.......................................................................................................................................................... 6
Deleting User
.......................................................................................................................................................... 6
Logging Out
2 Roles
................................................................................................................................... 7
7
Creating and Saving ..........................................................................................................................................................
Roles
.......................................................................................................................................................... 8
Getting Role Info
Getting List of Roles .......................................................................................................................................................... 8
.......................................................................................................................................................... 9
Deleting Role
3 Items
................................................................................................................................... 9
10
Creating and Saving..........................................................................................................................................................
Items
.......................................................................................................................................................... 10
Sharing Items
.......................................................................................................................................................... 12
Getting Item
.......................................................................................................................................................... 12
Getting List of Items
.......................................................................................................................................................... 13
Deleting Item
.......................................................................................................................................................... 14
Resource Item
..........................................................................................................................................................
15
Attaching Items to Reports
and Files
.......................................................................................................................................................... 16
Running Report
.......................................................................................................................................................... 17
Exporting Report Snapshot
Scheduling Actions .......................................................................................................................................................... 18
Index
2003-2015 Stimulsoft
Stimulsoft Reports
1.1
Users
To access information about users of the Stimulsoft Reports Server, there is a specialized user class
calledStiUserConnection that automatically handles much of the functionality required for user account
management. With this class, you will be able to add user account functionality in your app. In order to use
the class StiUserConnection you should create an instance of StiServerConnection and call one of its
methods (StiServerConnection.Users).
1.1.1
Signing Up
To create a first user, you must use the method SignUp() or asynchronous version SignUpAsync():
Or asynchronous method:
This call will create a new user in your instance of Stimulsoft Reports Server. This user must be the first and
he gets maximum permissions to work with the system. If you already have at least one user, an error will
occur. Before it does this, it also checks to make sure that both the username and email are unique. The
password (up to 6 characters) is stored on the server as a hash and is never sent to the client in the form of
a plaintext. In addition, we have two overridden methods for signup action with additional info (first name
and last name):
2003-2015 Stimulsoft
1.1.2
Logging In
Log in registered user uses the class methodLogin() (LoginAsync()):
Or asynchronous method:
1.1.3
2003-2015 Stimulsoft
Stimulsoft Reports
Or asynchronous method:
1.1.4
Asynchronous method:
2003-2015 Stimulsoft
1.1.5
Asynchronous method:
1.1.6
2003-2015 Stimulsoft
Stimulsoft Reports
Asynchronous method:
1.1.7
Asynchronous method:
In addition you can create a user through Roles using the method NewUser():
2003-2015 Stimulsoft
1.1.8
Deleting User
Remove element by calling Delete() (DeleteAsync()) the object class StiUser or by calling one of the
methods DeleteByKey(), DeleteByKeyAsync(), DeleteByName(), DeleteByNameAsync() from collection
StiServerConnection.Users:
Asynchronous example:
1.1.9
Logging Out
After all actions the user must log out. To do this, you can use the class methodsLogout() or
LogoutAsync().
Asynchronous method:
2003-2015 Stimulsoft
1.2
Stimulsoft Reports
Roles
Stimulsoft Reports Server supports a Role-based Access Control. Role is an object that determines the level
of user access to system resources. Members having the same role have the same rights of access to system
objects. The most important property of the role is StiRole.Permissions. It is an object of the class
StiRolePermissions that describes a set of permissions (StiPermissions) for system objects. StiPermissions
enumeration includes the following options:
None - Denies all;
Create - Allows creating an item;
Delete - Allows deleting an item;
Modify - Allows modifying an item;
Run - Allows running an item;
View - Allows viewing an item;
ModifyView - Allows modifying and viewing an item;
CreateDeleteModifyView - Allows creating, deleting, modifying and viewing an item;
RunView - Allows running and viewing an item;
All - Allows any action with an item.
In order to use the class StiUserConnection you should create an instance of StiServerConnection and call
one of its methods (StiServerConnection.Roles).
1.2.1
Asynchronous example:
2003-2015 Stimulsoft
1.2.2
Asynchronous method:
1.2.3
Asynchronous example:
2003-2015 Stimulsoft
Stimulsoft Reports
1.2.4
Deleting Role
Remove the role by calling DeleteByKey() (DeleteByKeyAsync()). Second way is creating an object of the
type StiRole, and then calling its method StiRole.Delete() (StiRole.DeleteAsync()):
Asynchronous method:
1.3
Items
The basis of the functional Stimulsoft Reports Server are operations on items. The item is an object that can
be visually observed in the object tree on the left side of the interface of the client application. All items are
inherited from the root abstract class StiItem and, depending on the functionality provided, are one of the
following classes:
StiCalendarItem - used to create a scheduler;
StiContactListItem - used for sending reports via e-mail;
StiDataSourceItem - used to connect external data sources;
StiFileItem - used to connect external data sources;
2003-2015 Stimulsoft
10
1.3.1
Asynchronous method:
1.3.2
Sharing Items
To work with elements uses a unique identifier - keys. They are assigned automatically when you create
elements.
2003-2015 Stimulsoft
11
Stimulsoft Reports
You can get the key from the Navigator selecting the Sharing menu item from the context menu. For example
in the URL http://localhost:40010/share/1b9b8b55e02042689624ea71596b7fff the item key
1b9b8b55e02042689624ea71596b7fff is a part after http://localhost:40010/share/. The simpler method
is select the Access Key menu item from the context menu:
Key can be used to specify a particular item in the API and to access an element outside over HTTP. This
example demonstrates a simple HTML-page that provides access to the report in the public domain:
2003-2015 Stimulsoft
12
<html>
<head>
<title>Sharing example</title>
</head>
<body>
<p style="font-size: 40px;">The example of shared report.</p>
<br>
<iframe src="http://localhost:40010/
share/569a4dcf7317452f8d96ef05ffa78d0a"></iframe>
</body>
</html>
1.3.3
Getting Item
To get an existing item is necessary to know the key that is passed to the method as a parameter. Use
methods StiItem.GetByKey() and StiItem.GetByKeyAsync():
Asynchronous method:
1.3.4
2003-2015 Stimulsoft
13
Stimulsoft Reports
current user can access. Use the method FetchAll() (FetchAllAsync()).
Asynchronous method:
1.3.5
Deleting Item
Remove element by calling Delete() (DeleteAsync()):
Asynchronous method:
2003-2015 Stimulsoft
14
1.3.6
Resource Item
Some element types (StiFileItem, StiReportSnapshotItem, StiReportTemplateItem) include resources.
Using
the
methods
UploadFromFile(),
UploadFromFileAsync(),
UploadFromArray(),
UploadFromArrayAsync(),
DownloadToFile(),
DownloadToFileAsync(),
DownloadToArray(),
DownloadToArrayAsync(). You can manipulate the data contained in these resources. For example, creating
a file on the server with the loading data into it looks like this:
Asynchronous method:
Loading item from the server and saving it to a file on the local computer as follows:
2003-2015 Stimulsoft
15
Stimulsoft Reports
Asynchronous method:
1.3.7
2003-2015 Stimulsoft
16
1.3.8
Running Report
The result of creating Report Template in the tree is a new element type StiReportTemplateItem. This object
describes the report without data. Designing items of the report is made through the Navigator interface, but
managing the construction is possible by means of appropriate methods StiReportTemplateItem.Run() and
StiReportTemplateItem.RunAsync(). The parameter specifies the item StiReportTemplateItem or
StiFileItem where you saved the rendered report. The object must be created before saving. The item
2003-2015 Stimulsoft
17
Stimulsoft Reports
StiFileItem can be one of the possible types of enumeration StiFileType (ReportSnapshot, PDF, XPS,
PowerPoint, HTML, Text, RichText, Word, OpenDocumentWriter, Excel, OpenDocumentCalc, Data, Image, XML,
XSD, CSV, DBF). One of these values are specified in the method StiServerConnection.Items.Root.NewFile()
as a parameter. The following example creates a report template, loads data into it and runs the report, after
which the result is stored in the report snapshot:
Asynchronous method creates a report template, converts data and runs the report, after which the result is
stored in the PDF file:
1.3.9
2003-2015 Stimulsoft
18
2003-2015 Stimulsoft
19
Stimulsoft Reports
To start the scheduler uses the StiSchedulerItem.Run() (StiSchedulerItem.RunAsync()) method. This
example creates a scheduler to render the report in a snapshot:
This asynchronous method creates a scheduler which renders the template to the PDF file:
2003-2015 Stimulsoft
20
This example creates a scheduler which renders the template to the PDF file and sends it to the email
addresses listed in the contact element:
2003-2015 Stimulsoft
21
Stimulsoft Reports
2003-2015 Stimulsoft