Report Builder FastReport .Net User Guide: Dynamic Layout Properties in Reports

FastReport .Net is a full-featured Windows Forms, ASP.NET and MVC report analysis solution. Using FastReport .NET can create .NET reports independent of applications. At the same time, FastReport .Net supports 14 languages ​​such as Chinese and English. You can make your products truly international.

When creating reports, it is often necessary to print a text with unknown dimensions. In this case, the following tasks need to be solved:

  • Calculate the height of the object so that it fits the entire text;
  • Calculate the height of the band to fit the object with variable amount of text;
  • Move or change the height of other objects so they do not interfere with the overall design of the report.

These tasks can be solved by using some object and stripe properties:

  • "CanGrow" and "CanShrink" properties allow automatic calculation of the object's height;
  • "ShiftMode" property allows to move objects located under the expanded object;
  • "GrowToBottom" property allows to resize an object to the bottom edge of the strip;
  • The "Anchor" and "Dock" properties allow to control the size of the object according to the size of the strap.

All these properties are discussed below (qun:585577353)

Growable, Shrinkable Properties

Every tape and report object has these properties. They determine whether an object can grow or shrink based on the size of its contents. If both properties are disabled, the object will only have the specified dimensions.

These properties are useful if you need to print a text that was not sized at design time. In order for an object to hold the entire text, it needs to have "CanGrow" and "CanShrink" enabled:

1

The following objects can affect the height of a strap:

  • "Text";
  • "Rich Text";
  • "Picture" (and "AutoSize" which works correctly);
  • "Table".
ShiftMode Property

Every report object has this property. This property can only be accessed in the "Properties" window. An object whose "ShiftMode" property is enabled will be shifted up or down if the object above it can grow or shrink.

1

The "ShiftMode" property can have the following values:

  • always (default). Indicates that the object needs to be shifted all the time.
  • never. Indicates that the object does not need to be displaced.
  • WhenOverlapped. Indicates that, in this case, the object needs to move if the expanded object is just above it (that is, the two objects overlap horizontally).

This property is handy when printing information in tables where several cells are located on top of each other and can have varying amounts of text.

GrowToBottom property

Every report object has this property. When printing an object with this property, it stretches up to the bottom edge of one band:

1

When printing information in tables, there may be several objects that can be stretched in one table row. This property sets the height of all objects to the maximum height of the band.

anchor attribute

Every report object has this property. It determines how the object will change its position and/or its size when the container it is in changes its size. By using an Anchor, an object's expansion or movement can be synchronized with its container.

In many cases the container referred to is a belt. But this doesn't have to be - it could also be a "Table" or "Matrix" object.

The "Anchor" property can have one of the following values, or any combination of them:

Value Description
Left Anchor the left edge of the object. Objects don't move left/right when the container's size changes.
Top Anchor the top edge of the object. Objects don't move up/down when container's height is changed.
Right Anchor the right edge of the object. As the width of the container changes, the distance between the right edge of the object and the container is constant. If the container's left edge is also anchored, then the object will grow and shrink in sync with the container.
Bottom A anchors the bottom edge of the object. As the height of the container changes, the distance between the bottom edge of the object and the container is constant. If the object's top edge is also anchored, the object will grow and shrink in sync with the container.

By default, the value of this property is Left, Top. Indicates that the object does not change when the size of the container changes. In the table below, some frequently used value combinations are given:

Value Description
Left, Top Defaults. This object does not change when the size of the container changes.
Left, Bottom When the container's height changes, the object moves up/down. The position of the object relative to the bottom edge of the container does not change.
Left, Top, Bottom When the height of the container changes, the height of the object also changes synchronously.
Left, Top, Right, Bottom When the container's width and height change, the object grows or shrinks accordingly.
Dock properties

Every report object has this property. This property determines which side of the container the object will be docked to.

The "Dock" property may have the following values:

Value Description
None Defaults. The object is not docked.
Left The object is docked to the left edge of the container. The object's height will be equal to the container's height*.
Top The object is docked to the top edge of the container. The object's width will be equal to the container's width*.
Right The object is docked to the right edge of the container. The object's height will be equal to the container's height*.
Bottom The object is docked to the bottom edge of the container. The object's width will be equal to the container's width*.
Fill The object occupies all the free space of the container.
  • The situation is different if several objects are docked at the same time. The image below shows two objects, the first docked to the top edge of the container and the second docked to the left:

1

As you can see, the height of the second object is equal to the height of free space, which is left after docking with the first object.

The docking behavior depends on the object's creation order. You can change the order in the context menu of an object. To do this, select either the "Bring to front" or "Send to back" menu items.

Guess you like

Origin blog.csdn.net/m0_67129275/article/details/132337957