Skip to content

Commit b9d213d

Browse files
committed
update WebReport.md
1 parent 6b275b6 commit b9d213d

16 files changed

+113
-62
lines changed

Bands.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Bands
1+
# 2.3. Bands
22

33
The band is an object which is located directly on the report page and is a container for other objects like "Text", "Picture" and others.
44

CreatingReportUsingCode.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Let us consider how to create a report in code.
44

5-
```
5+
```csharp
66
Report report = new Report();
77
// register the "Products" table
88
report.RegisterData(dataSet1.Tables["Products"], "Products");

Data.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Data
1+
# 3. Data
22
Any report prints some data. In FastReport, you can operate with the following data:
33

44
- data sources;
@@ -19,7 +19,7 @@ DB table content is not saved in a report file. Instead, the connection string a
1919

2020
There can be parameters in a query text. Let us see the following query:
2121

22-
```
22+
```sql
2323
select * from DVDs
2424
where Title = @param1
2525
```
@@ -54,7 +54,7 @@ In the first way, you pass a value programmatically. Since there is no easy way
5454

5555
- Pass a value to the report parameter:
5656

57-
```
57+
```csharp
5858
report1.SetParameterValue("MyReportParameter", 10);
5959
```
6060

@@ -171,7 +171,7 @@ Let us see one example of using parameters. Assuming we have a report which prin
171171

172172
To pass parameter value from your program to the report, use the following code:
173173

174-
```
174+
```csharp
175175
report1.SetParameterValue("EmployeeID", 2);
176176
```
177177

Exporting.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Exporting
1+
# 7. Exporting
22

33
The following is an example of exporting a report in Jpeg file.
44

5-
```
5+
```csharp
66
// export to image
77
ImageExport image = new ImageExport();
88
image.ImageFormat = ImageExportFormat.Jpeg;
@@ -11,4 +11,4 @@ The following is an example of exporting a report in Jpeg file.
1111

1212
---
1313

14-
[Creating Report Using Code](CreatingReportUsingCode.md) | [Top Page](README.md) | [WebReport](WebReport.md)
14+
[Creating Report Using Code](CreatingReportUsingCode.md) | [Top Page](README.md) | [Reports in Web](WebReport.md)

Expressions.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Expressions
1+
# 4. Expressions
22

33
In many places in FastReport, expressions are used. For example, the "Text" object can contain expressions in square brackets.
44

@@ -52,7 +52,7 @@ You have access to all .Net objects declared in these assemblies. If you need to
5252

5353
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:
5454

55-
```
55+
```csharp
5656
namespace Demo
5757
{
5858
public static class MyFunctions
@@ -67,7 +67,7 @@ namespace Demo
6767

6868
You can use it in your report in the following way:
6969

70-
```
70+
```csharp
7171
Demo.MyFunctions.Func1()
7272
```
7373

@@ -128,21 +128,21 @@ The error occurs because, you never mix strings with numbers. For this, you need
128128

129129
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:
130130

131-
```
131+
```csharp
132132
(string)(Report.GetColumnValue("Employees.FirstName")) + " " +
133133
(int)(Report.GetColumnValue("Employees.Age")).ToString()
134134
```
135135

136136
As seen, FastReport changes reference to data columns in the following way:
137137

138-
```
138+
```csharp
139139
[Employees.FirstName] --> (string)(Report.GetColumnValue("Employees.FirstName"))
140140
[Employees.Age] --> (int)(Report.GetColumnValue("Employees.Age"))
141141
```
142142

143143
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:
144144

145-
```
145+
```csharp
146146
[Employees.FirstName].Substring(0, 1)
147147
```
148148

@@ -171,7 +171,7 @@ This expression returns the current year. As "Date" variable has DateTime type,
171171

172172
FastReport converts reference to system variable into the following form (for example, the "Date" variable):
173173

174-
```
174+
```csharp
175175
((DateTime)Report.GetVariableValue("Date"))
176176
```
177177

@@ -185,7 +185,7 @@ In order to refer to a total value, use its name:
185185

186186
FastReport converts reference to totals into the following form:
187187

188-
```
188+
```csharp
189189
Report.GetTotalValue("TotalSales")
190190
```
191191

@@ -213,7 +213,7 @@ Parameters have a definite data type. It is set in the "DataType" property of th
213213

214214
FastReport converts reference to a report parameter into the following way:
215215

216-
```
216+
```csharp
217217
((string)Report.GetParameterValue("Parameter1"))
218218
```
219219

Fundamentals.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Fundamentals
1+
# 2. Fundamentals
22

33
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.
44

Introduction.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# 1. Introduction
2+
13
## What is FastReport?
24

35
FastReport provides open source report generator for .NET Core 2.x/.Net Framework 4.x. You can use the FastReport in MVC, Web API applications.

README.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,29 @@ We wish to draw up your attention to the fact that Documentation is under constr
1212

1313
## Table of Contents
1414

15-
### [Introduction](Introduction.md)
15+
### 1. [Introduction](Introduction.md)
1616

17-
### [Fundamentals](Fundamentals.md)
18-
#### [The Report](Report.md)
19-
#### [Report Pages](ReportPages.md)
20-
#### [Bands](Bands.md)
21-
#### [Report Objects](ReportObjects.md)
17+
### 2. [Fundamentals](Fundamentals.md)
18+
#### 2.1. [The Report](Report.md)
19+
#### 2.2. [Report Pages](ReportPages.md)
20+
#### 2.3. [Bands](Bands.md)
21+
#### 2.4. [Report Objects](ReportObjects.md)
2222

23-
### [Data](Data.md)
23+
### 3. [Data](Data.md)
2424

25-
### [Expressions](Expressions.md)
25+
### 4. [Expressions](Expressions.md)
2626

27-
### [Script](Script.md)
27+
### 5. [Script](Script.md)
2828

29-
### [Report Creation](ReportCreation.md)
30-
#### [FastReport Designer Community Edition](FastReportDesignerCommunityEdition.md)
31-
#### [FastReport Online Designer](FastReportOnlineDesigner.md)
32-
#### [Report Template File Structure](ReportTemplateFileStructure.md)
33-
#### [Creating a Report by Using Code](CreatingReportUsingCode.md)
29+
### 6. [Report Creation](ReportCreation.md)
30+
#### 6.1. [FastReport Designer Community Edition](FastReportDesignerCommunityEdition.md)
31+
#### 6.2. [FastReport Online Designer](FastReportOnlineDesigner.md)
32+
#### 6.3. [Report Template File Structure](ReportTemplateFileStructure.md)
33+
#### 6.5. [Creating a Report by Using Code](CreatingReportUsingCode.md)
3434

35-
### [Exporting](Exporting.md)
35+
### 7. [Exporting](Exporting.md)
3636

37-
### [Web Reports](WebReport.md)
37+
### 8. [Reports in Web](WebReport.md)
3838

3939
### [APPENDIX I: Examples](Examples.md)
4040
### [APPENDIX II: Class Reference](https://fastreports.github.io/FastReport.Documentation/ClassReference/api/FastReport.html)

Report.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# The Report
1+
# 2.1. The Report
22

33
The report building process can be represented as follows:
44

ReportCreation.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Report Creation
1+
# 6. Report Creation
22

3-
### [FastReport Designer Community Edition](FastReportDesignerCommunityEdition.md)
4-
### [FastReport Online Designer](FastReportOnlineDesigner.md)
5-
### [Report Template File Structure](ReportTemplateFileStructure.md)
6-
### [Creating a Report by Using Code](CreatingReportUsingCode.md)
3+
### 6.1. [FastReport Designer Community Edition](FastReportDesignerCommunityEdition.md)
4+
### 6.2. [FastReport Online Designer](FastReportOnlineDesigner.md)
5+
### 6.3. [Report Template File Structure](ReportTemplateFileStructure.md)
6+
### 6.4. [Creating a Report by Using Code](CreatingReportUsingCode.md)
77

88
---
99

ReportObjects.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Report Objects
1+
# 2.4. Report Objects
22

33
A wide variety of objects can be used in a report.
44

ReportPages.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Report Pages
1+
# 2.2. Report Pages
22

33
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:
44

ReportTemplateFileStructure.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The following is an example of the structure of a report template file.
44

5-
```
5+
```xml
66
<?xml version="1.0" encoding="utf-8"?>
77
<Report ScriptLanguage="CSharp" TextQuality="Regular" ReportInfo.Name="Simple List" ReportInfo.Author="Fast Reports Inc" ReportInfo.Description="Demonstrates simple list report. To create it:&#13;&#10;- go to &quot;Data&quot; menu and select &quot;Choose Report Data...&quot; item to select datasource;&#13;&#10;- go to &quot;Report|Configure Bands...&quot; menu to create the band structure;&#13;&#10;- return to the report page, doubleclick the data band to show its editor;&#13;&#10;- choose the datasource;&#13;&#10;- 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">
88
<Dictionary>

Script.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Script
1+
# 5. Script
22

33
Script is a higher-level programming language, which is part of the report. Script can be written in one of the following .Net languages:
44

@@ -17,7 +17,7 @@ A script is applicable in many places. Using the script, you can do the followin
1717

1818
A script is mainly used for creating objects' event handlers. For creating event handler select the needed object.
1919

20-
```
20+
```csharp
2121
private void Text2_BeforePrint(object sender, EventArgs e)
2222
{
2323

@@ -56,13 +56,13 @@ So, by using events of different objects, you can control every step of report f
5656

5757
For referring to report objects (for example, "Text" object) use the name of the object. The following example returns the height of Text1 object:
5858

59-
```
59+
```csharp
6060
float height = Text1.Height;
6161
```
6262

6363
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:
6464

65-
```
65+
```csharp
6666
float heightInPixels = Text1.Height;
6767
float heightInCM = heightInPixels / Units.Centimeters;
6868
Text1.Height = Units.Centimeters * 5; // 5см
@@ -139,7 +139,7 @@ Item1
139139

140140
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
141141

142-
```
142+
```csharp
143143
Engine.AddOutline("Item1");
144144
Engine.AddOutline("Item2");
145145
Engine.AddOutline("Item3");
@@ -158,7 +158,7 @@ Item1
158158

159159
The OutlineRoot method moves the current element to the root of the outline. For example, the following script:
160160

161-
```
161+
```csharp
162162
Engine.AddOutline("Item1");
163163
Engine.AddOutline("Item2");
164164
Engine.AddOutline("Item3");
@@ -185,25 +185,25 @@ The GetBookmarkPage method returns the page number on which the bookmark is plac
185185

186186
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:
187187

188-
```
188+
```csharp
189189
string productName = (string)Report.GetColumnValue("Products.Name");
190190
```
191191

192192
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:
193193

194-
```
194+
```csharp
195195
string categoryName = (string)Report.GetColumnValue("Products.Categories.CategoryName");
196196
```
197197

198198
For referring to the data source itself, use the GetDataSource method of the Report object:
199199

200-
```
200+
```csharp
201201
DataSourceBase ds = Report.GetDataSource("Products");
202202
```
203203

204204
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:
205205

206-
```
206+
```csharp
207207
// get a reference to the data source
208208
DataSourceBase ds = Report.GetDataSource("Products");
209209
// initialize it
@@ -224,21 +224,21 @@ while (ds.HasMoreRows)
224224

225225
For reference to system variables, use the GetVariableValue method of the Report object:
226226

227-
```
227+
```csharp
228228
DateTime date = (DateTime)Report.GetVariableValue("Date");
229229
```
230230

231231
## Reference to total values
232232

233233
For reference to the total value, use the GetTotalValue method of the Report object:
234234

235-
```
235+
```csharp
236236
float sales = Report.GetTotalValue("TotalSales");
237237
```
238238

239239
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:
240240

241-
```
241+
```csharp
242242
float tax = Report.GetTotalValue("TotalSales") * 0.2f;
243243
```
244244

@@ -248,21 +248,21 @@ Reference to the total value can be done at that time when, it is being processe
248248

249249
For referring to report parameters, use the GetParameterValue method of the Report object:
250250

251-
```
251+
```csharp
252252
int myParam = (int)Report.GetParameterValue("MyParameter");
253253
```
254254

255255
Parameters can be nested. In this case, indicate the name of the parent parameter and after the period, the name of the child parameter:
256256

257-
```
257+
```csharp
258258
Report.GetParameterValue("ParentParameter.ChildParameter")
259259
```
260260

261261
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.
262262

263263
For changing the value of the parameter, use the SetParameterValue method of the report object:
264264

265-
```
265+
```csharp
266266
Report.SetParameterValue("MyParameter", 10);
267267
```
268268

0 commit comments

Comments
 (0)