Report and Engine objects |
Top Previous Next |
Apart from objects, which are contained in the report, there are two variables defined in the script: Report and Engine.
The Report variable refers to the current report. In the list below, a list of the report object's methods is given:
The Engine object is an engine that controls the report creation. By using the methods and properties of the engine, you can manage the process of placing bands onto the page. You can use the following properties of the Engine object:
On the figure below, you can see the meaning of some properties listed above.
Engine.PageWidth and Engine.PageHeight properties determine the size of the printing area, which is almost always less than the actual size of the page. Size of the printed area is determined by the page margins, which is given by the LeftMargin, TopMargin, RightMargin and BottomMargin page properties.
Engine.FreeSpace property determines the height of the free space on the page. If there is the "Page footer" band on the page, its height is considered when calculating the FreeSpace. Note that, after printing a band, free space is reduced.
How does the formation of a prepared report page take place? FastReport engine displays bands on the page until there is enough space for band output. When there is no free space, the "Report footer" band is printed and a new empty page is formed. Displaying a band starts from the current position, which is determined by the X and Y coordinates. This position is retuned by the Engine.CurX and Engine.CurY properties. After printing a band, CurY automatically increases by the height of the printed band. After forming a new page, the position of the CurY is set to 0. The position of the CurX changes when printing a multicolumn report.
Engine.CurX and Engine.CurY properties are accessible not only for reading, but also for writing. This means that you can shift a band manually by using one of the suitable events. Examples of using these properties can be seen in the "Examples" section.
When working with properties, which return the size or position, remember that, these properties are measured in the screen pixels.
In the Engine object, the following methods are defined:
By using the AddOutline, OutlineRoot, OutlineUp methods, you can form the report outline manually. Usually, this is done automatically with the help of the OutlineExpression property, which every band and report page have got.
The AddOutline method adds a child element to the current outline element, and makes it current. The current report page and the current position on the page are associated with the new element. If you call the AddOutline method several times, then you will have the following structure:
Item1 Item2 Item3
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
Engine.AddOutline("Item1"); Engine.AddOutline("Item2"); Engine.AddOutline("Item3"); Engine.OutlineUp(); Engine.AddOutline("Item4");
will create the following outline:
Item1 Item2 Item3 Item4
The OutlineRoot method moves the current element to the root of the outline. For example, the following script:
Engine.AddOutline("Item1"); Engine.AddOutline("Item2"); Engine.AddOutline("Item3"); Engine.OutlineRoot(); Engine.AddOutline("Item4");
will create the following outline:
Item1 Item2 Item3 Item4
For working with bookmarks, the AddBookmark and GetBookmarkPage methods of the Engine object are used. Usually bookmarks are added automatically when using the Bookmark property, which all objects of the report have got.
By using the Add Bookmark method, you can add a bookmark programmatically. This method creates a bookmark on the current page at the current printing position.
The GetBookmarkPage method returns the page number on which the bookmark is placed. This method is often used when creating the table of contents, for displaying page numbers. In this case, the report must have a double pass. |