We will introduce cell style of FineReport reporting tool in this article.Please note that the style only controls cell display effect and will not influence the actual value of cell.

1. Overview

Right click the cell and select style in report designer. For example, you can set font, border and background for the cell in the Cell Attribute Table at right. Please note that the style only controls cell display effect and will not influence the actual value of cell, as shown below:

After clicking Cell > Style, you can select custom style or predefined style. The default is custom style, as shown above. Click Predefined Style to display all predefined styles, as shown below:

Predefined style: the styles predefined at Server side (i.e., global styles), which are available for all templates. Style information is saved in config.xml. For specific definitions, refer to Predefined Style.

Custom style: the style customized by the user, which is only work for current cell.

Note: When you right click the cell in designer and find no predefined styles as shown above in Select Style, it means that the contents of defined styles in config.xml have been deleted.

2. Custom style

Select Style in the Cell Attribute Table at right of report body, as shown below. You can set the format, align, font, border and background for the cell content.

2.1 Format

You can set display formats for various data types, like number and time, as shown below:

2.1.1. Number style

Number display format, as shown below: 0: formatting. If the format encounters no values, display 0. For example, format 0.00 means to display two decimal places (e.g., display 0.123 as 0.12 or display 0.1 as 0.10); #: formatting. If the format encounters no values, do not display 0. For example, format 0.0# means to display decimal up to 2 places (e.g., display 0.123 as 0.12 or display 0.1 as 0.1); the figure below lists some common styles, and you can edit styles in red box. For example, custom style 0.000 means to display three decimal places; and fr #0.0# means to add fr at the front of two decimal places, and so on.

You can edit any display effects, which are not limited to the aforesaid. For example: To display data 5.0, 5.123, 5.1 in a data column as 5, 5.12 and 5.1, you can set the cell format in the data column as “0.##”.

2.1.2. Currency style

For currency formats, ¤0 means to add a ¥ at the front of an integer, where ¤#, ##0.00 have similar principles with number formats.

2.1.3. Percentage style

In percentage, you can choose to display the decimal places. Or you can add decimal places and other characters.

2.1.4. Date type style

In date type, you can set the date display format. However, please not that month must be an uppercase M and a lowercase m cannot be identified.

To display the date type data as “20110101”, set the format as “yyyyMMdd”, as shown below:

Note: You can manually input date format.

Other formats will not be repeated.

2.2 Align

2.2.1. Align type

Align type means the type to align cell texts, including horizontal align and center. Horizontal align has four options: Left Align, Right Align, Center and Justify. There is a default align type: Right-align numbers and left-align texts. As shown below:

2.2.2. Text control

In single line display of text control, the font will not be adjusted. The text display depends on the cell size, and extra-long text will not be visible. Single-line display (font adjusted) and multi-line display (font adjusted) will adjust font display based on cell size. The effect is shown below: Wrap text

Note: To make wrap text work, you must set AutoFit Row Height and Wrap Text for the cell. If only Wrap Text is set, it will not work, as Wrap Text and AutoFit Row Height are two related attributes.

2.2.3. Text direction

Text flow can be Text Vertical (including From Left to Right and From Right to Left); only when Text Vertical is not selected, you can adjust display angle (e.g., 30°);

2.2.4. Specials in Text Vertical

In pre-8.0 versions, brackets () in Vertical are not processed and have to be manually realized via custom functions. However, V8.0 takes uniform processing for specials. The effect is as follows:

2.2.5. Indent

Indent effect is as shown below:

2.2.6. Space

Before: Space before cell text.

After: Space after cell text.

Row space: space between row texts in a cell.

2.3 Font

In Font part, you can set font type, font size, font style size, underline, color, strikeout, hatch, superscript/subscript (default as neither superscript nor subscript), as shown below:

Note 1: as limited by chrome browser, the minimum font size is 9 when the report is viewed in chrome browser, even when you have set a smaller font.

Note 2: hatch is set as post-hatch effect, which is temporarily not supported under ie browser. In other browsers, you can see normal effect.

2.4 Border

You can set style and color for border line of a cell.

Note: You can set border style in Cell Attribute Table or click the button in toolbar, as shown below:

2.5 Background

You can select texture, picture and color for the background. Setting method is same as the Paper Backgroud which will not be repeated here.

[AuthorRecommendedPosts post-id="3737"]