Displaying information directly from the database doesn’t often look very nice. So, formatting a report plays a vital role in data reporting. Formatting a report includes highlighting important numbers; putting the focus on specific sets of data, applying colors, fonts, and backgrounds; and formatting labels and values. It improves the design and sense of a report and helps zoom in on key sections of it.
In the Bold Reports Designer, to make the reports look further engaging, you can format data after retrieving it from a database using static or dynamic formatting. In this blog, I am going to present simple formatting examples with table cell formatting.
Choose a cell in the table report item and open the Properties panel. It will open with various properties with which we can format the data in the table cell.
Under the Basic Settings category, you can directly enter the required format in the Format property text field or click on the button to open the format dialog.
I am going to use the Format Dialog.
Follow these steps to present the data set field in integer, currency, and percentage formats in a report.
To display the Population field values as an integer number, open the format dialog for the respective text box. Choose Number as the Type, enter 0 in Decimal Places, enable the Use 1000 Separator(,) check box, and let the other options remain with their default values.
By default, during report run time the formatting will be applied based on default system language settings. You can change the language under Localization category in the text box properties. I am changing the language code to bg, Bulgarian.
At run time, the formatting will be applied based on the selected language code. In Bulgarian format, the comma separators will be treated as spaces. In the following report preview, you can see the data in the population column is separated with spaces.
Now, I am going to display the Price data field in German currency format:
- Open the format dialog for the right text box.
- Choose Currency as the Type.
- Enter 2 in Decimal Places.
- Set the Currency Culture to German to display the currency symbol.
- Enable the Use 1000 Separator(,) check box.
- Select –€12345 in Negative values to display negative values with the minus symbol.
- Let the other options remain with their default values.
- Click OK.
Now, let’s further format the Price data field using the localization property. Set the language code to de in the Localization property.
At run time, the data in the Price column is displayed in German cultural format. In German culture, the comma and period characters switch functions from American culture, with periods visually breaking up larger numbers and commas separating whole numbers from fractions.
To display the Discount data field in percentage format, open the format dialog for the respective text box. Choose Percentage as the Type, enter 0 in Decimal Places, and let the other options remain with their default values.
Click OK. At run time, the data in the Discount column is formatted as percentage values with no decimal points.
To display the Date field in the desired date format, open the format dialog for the respective text box. Choose Date as the Type, and the 31 Jan 2000 format in the Date drop-down.
Click OK. At run time, the data in the Birth Date column is formatted to dd MM yyyy format.
You can present plain text content or HTML-formatted text from a data set field in a report and format it using the properties listed in the Properties panel.
To format plain text, select the respective table cell or text box and open the Properties panel. We can format the font properties in the Basic Settings category, set the alignment properties in the Alignment category, set the border and fill color of the text box in the Appearance category, and a few other properties.
You can understand how formatting options change the look and feel of the report from following designs.
You can display HTML-formatted text in the report using the Markup Type property in a text box report item. Enter the HTML-formatted text directly or dynamically insert a field from your data set that returns HTML text. Refer to the “Add HTML into a report” documentation for more information.
In the Bold Reports Designer, we can dynamically format reports using Expressions. During report run time, the expressions are evaluated and applied to the data. Refer to the “Display dynamic text using expressions” documentation for more information about formatting text using expressions in text box report items. Here, I am going to format the text from the data set field using a particular text case format. Select the proper expression text in the text box and right-click.
Click on the Expression option in the menu and the Expression Builder will open with existing data set field expression format.
Now, using StrConv and vbProperCase functions, we can convert the casing of the string. The StrConv function converts a string of text into the proper case; vbProperCase converts the first letter of every word in the string to uppercase and all other characters to lowercase. Modify the expression as required and click OK.
At run time, this expression will be evaluated and applied to the specific data in the report.
I hope this blog provided a clear idea about the formatting options available and how to enhance your report using them in the Report Designer. To explore further, go through our sample reports and Bold Reports documentation.
If you have any questions, please post them in the comments section. You can also contact us by submitting them through our contact page, or if you already have an account, you can log in to submit them.
Bold Reports now comes with a 15-day free trial with no credit card information required. We welcome you to start a free trial and experience Bold Reports for yourself. Give it a try and let us know what you think!
Stay tuned to our official Twitter, Facebook, LinkedIn, Pinterest, and Instagram pages for announcements about upcoming releases.