You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Expressions.md
+9-9
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Expressions
1
+
# 4. Expressions
2
2
3
3
In many places in FastReport, expressions are used. For example, the "Text" object can contain expressions in square brackets.
4
4
@@ -52,7 +52,7 @@ You have access to all .Net objects declared in these assemblies. If you need to
52
52
53
53
For example, if you want to use a function in your report which was declared in your application, add application assembly (.exe or .dll) in a report assemblies list. After that you can call the function by using namespace of your application. For example, if the following function is defined in application:
54
54
55
-
```
55
+
```csharp
56
56
namespaceDemo
57
57
{
58
58
publicstaticclassMyFunctions
@@ -67,7 +67,7 @@ namespace Demo
67
67
68
68
You can use it in your report in the following way:
69
69
70
-
```
70
+
```csharp
71
71
Demo.MyFunctions.Func1()
72
72
```
73
73
@@ -128,21 +128,21 @@ The error occurs because, you never mix strings with numbers. For this, you need
128
128
129
129
In this case, we refer to the "Employees.Age" column as if it is an integer variable. And it is so. We know that all expressions are compiled. All non-standard things (like referring to data columns) from a compiler's point of view are converted into another type, which is understandable to a compiler. So, the last expression will be turned into the following form:
That is, we can use data column in an expressions as if it is a variable having a definite type. For example, the following expression will return the first symbol of an employee's name:
144
144
145
-
```
145
+
```csharp
146
146
[Employees.FirstName].Substring(0, 1)
147
147
```
148
148
@@ -171,7 +171,7 @@ This expression returns the current year. As "Date" variable has DateTime type,
171
171
172
172
FastReport converts reference to system variable into the following form (for example, the "Date" variable):
173
173
174
-
```
174
+
```csharp
175
175
((DateTime)Report.GetVariableValue("Date"))
176
176
```
177
177
@@ -185,7 +185,7 @@ In order to refer to a total value, use its name:
185
185
186
186
FastReport converts reference to totals into the following form:
187
187
188
-
```
188
+
```csharp
189
189
Report.GetTotalValue("TotalSales")
190
190
```
191
191
@@ -213,7 +213,7 @@ Parameters have a definite data type. It is set in the "DataType" property of th
213
213
214
214
FastReport converts reference to a report parameter into the following way:
Copy file name to clipboardExpand all lines: Fundamentals.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Fundamentals
1
+
# 2. Fundamentals
2
2
3
3
In this chapter we will learn the principles of working with a report in the FastReport. We will also take a close look at report elements such as report pages, bands, and report objects.
Copy file name to clipboardExpand all lines: ReportPages.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Report Pages
1
+
# 2.2. Report Pages
2
2
3
3
Template consists of one (mostly) or several report pages. Report page, in turn, contains bands. Report objects like Text, Picture and others are placed on the band:
Copy file name to clipboardExpand all lines: ReportTemplateFileStructure.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
The following is an example of the structure of a report template file.
4
4
5
-
```
5
+
```xml
6
6
<?xml version="1.0" encoding="utf-8"?>
7
7
<ReportScriptLanguage="CSharp"TextQuality="Regular" ReportInfo.Name="Simple List" ReportInfo.Author="Fast Reports Inc" ReportInfo.Description="Demonstrates simple list report. To create it: - go to "Data" menu and select "Choose Report Data..." item to select datasource; - go to "Report|Configure Bands..." menu to create the band structure; - return to the report page, doubleclick the data band to show its editor; - choose the datasource; - drag data from the Data Dictionary window to the band." ReportInfo.Created="01/17/2008 03:05:57" ReportInfo.Modified="07/26/2018 12:14:37" ReportInfo.CreatorVersion="1.0.0.0">
@@ -56,13 +56,13 @@ So, by using events of different objects, you can control every step of report f
56
56
57
57
For referring to report objects (for example, "Text" object) use the name of the object. The following example returns the height of Text1 object:
58
58
59
-
```
59
+
```csharp
60
60
floatheight=Text1.Height;
61
61
```
62
62
63
63
Note that report's native unit of measurement is screen pixels. Keep it in mind when using such object's properties like Left, Top, Width, and Height. To convert pixels into centimeters and back, use the constants, defined in the "Units" class:
64
64
65
-
```
65
+
```csharp
66
66
floatheightInPixels=Text1.Height;
67
67
floatheightInCM=heightInPixels/Units.Centimeters;
68
68
Text1.Height=Units.Centimeters*5; // 5см
@@ -139,7 +139,7 @@ Item1
139
139
140
140
For controlling the current element, there are OutlineUp and OutlineRoot methods. The first method moves the pointer to the element, located on a higher level. So, the script
141
141
142
-
```
142
+
```csharp
143
143
Engine.AddOutline("Item1");
144
144
Engine.AddOutline("Item2");
145
145
Engine.AddOutline("Item3");
@@ -158,7 +158,7 @@ Item1
158
158
159
159
The OutlineRoot method moves the current element to the root of the outline. For example, the following script:
160
160
161
-
```
161
+
```csharp
162
162
Engine.AddOutline("Item1");
163
163
Engine.AddOutline("Item2");
164
164
Engine.AddOutline("Item3");
@@ -185,25 +185,25 @@ The GetBookmarkPage method returns the page number on which the bookmark is plac
185
185
186
186
Contrary to the FastReport expressions (covered in the "Expressions" section), never use square brackets in script for referring to the data sources. Instead of this, use the GetColumnValue method of the Report object, which returns the value of the column:
As seen, you need to indicate the name of the source and its column. The name of the source can be compound in case, if we are referring to the data source by using a relation. Details about relations can be found in the "Data" chapter. For example, you can refer to a column of the related data source in this way:
Help on properties and methods of the DataSourceBase class can be received from the FastReport.Net Class Reference help system. As a rule, this object is used in the script in the following way:
For reference to the total value, use the GetTotalValue method of the Report object:
234
234
235
-
```
235
+
```csharp
236
236
floatsales=Report.GetTotalValue("TotalSales");
237
237
```
238
238
239
239
Total value has got the FastReport.Variant type. It can be used directly in any expression, because the FastReport.Variant type is automatically converted to any type. For example:
Parameters have got a definite data type. It is given in the DataType property of the parameter. You must take this into account when referring to parameters.
262
262
263
263
For changing the value of the parameter, use the SetParameterValue method of the report object:
0 commit comments