Using a ruler in RichText editor for FastReport .NET


A ruler has been added to the RichText editor. It allows users to control tab width and set indents before the left and right margins.

To add a tab stop, you need to double-click the left mouse button on the horizontal ruler in the place where it is needed. An "arrow" will appear in the selected area, indicating the tab stop point. When holding the left mouse button on this "arrow", you can change its location by moving the mouse. At the same time, while pressing and moving the “arrow”, a guide will be displayed, which clearly shows the future location of the text after the tabulation.

An example of a given tab stop on a ruler:

Tab stop point on a ruler

If the tab is not needed, you can remove it with a right-click on it.

You can set indents by hovering over the end of the ruler corresponding to the indent. This will change the cursor from the main mode to the horizontal resizing mode. They can be changed just at the moment when you hold down the left button.

When changing the left indent, the initial position of the text will change, and the positions of the already set tab stops relative to this indent will also change. When changing the right indent, the text wrapping location will be set. It is worth noting that the position of the right indent will change relative to the right edge of the text field if its dimensions are changed.

An example of a rich text without indents:

Rich text without indents

Example of a rich text with left and right indent:

Rich text with left and right indent

It is also worth noting the formatting using a ruler with respect to the entire text and its parts. If the RichObject was empty at the beginning of editing, then the specified formatting will be applied to all text as it is written. This will happen until the cursor is moved to any line with the mouse or some part of the text is selected. In the case where the RichObject was not empty, the ruler at the beginning of editing will display the formatting of the first line.

If you want to apply formatting to a part of the text, then select the necessary part and then the formatting of the selected part will be displayed on the ruler. This part will be "clean" in 2 cases:

- if different formatting is applied to different parts of the text;
- if there is no formatting for this fragment.

When changing text with different formatting, the old formatting will be replaced by the new one. Selecting all text for formatting with a ruler is a special case, due to which the text selection will be removed immediately after any manipulation on the ruler. Additionally, the selection will disappear for all text that already exists or will be written, and the formatting that is currently set will be applied.

This change should make reporting easier by enhancing the RichText editor in the designer and reducing the need for a user to use third-party text editors when creating rich text.