This blog is all about the styling and layout options you can use with Document Creator. Document Creator has a large variety of options and tools to help you to achieve the desired look and feel. This blog covers some of those options. Together with Document Creator we also supply a “Document Creator Designer Demo”. In that demo application many more styling options are explained.
Borders and Fill
Almost all report objects have the border and fill property. To work with these properties, use the “Border and Fill” toolbar:
Much like Microsoft Excel, the object’s border consists of four lines. Each line can have different width, color and style. The toolbar button displays a dialog which allows to set up each line separately, it is even possible to apply shadow to create some depth:
To work with fill, there are two buttons on the toolbar. The ‘bucket’ button allows to choose a color for the solid fill type. The ‘rectangle’ button displays a dialog which allows to choose between different fill types:
Combining all these options can help you to achieve something like this:
To change the “Text” object appearance, use the “Text” toolbar:
With text rotation you can format your text in any desired angle. Conditional Highlight is explained later on.
To quickly set the right object appearance, you may want to use styles. A style is a predefined set of the following properties: border, fill, font, text color.
The list of styles is stored in the report. You can control it either from the “Report>Styles” menu or by clicking the button in the “Style” toolbar:
You can set an object’s style in the following ways:
• set the “Style” property in the “Properties” window;
• use the “Style” toolbar
When you set the object’s style, the object’s appearance will be changed according the style settings. When you change the style settings, the object with that style will change automatically. So when you set the style property on all your text boxes, changing the style will change all your textboxes at once. Styles can be saved and loaded as a file.
Again, just like in Excel, there is a possibility to change the “Text” object’s appearance depending on conditions. For example, an object can be highlighted with red color if it has a negative value.
This feature is called “conditional highlighting”. To set up it, select the “Text” object and click the Highlight button on the “Text” toolbar. You will see the following dialog window:
It is possible to define one or more conditions and set the style for every condition. Styles can contain the following settings: border, fill, text color and font. You can indicate, which settings need to be changed when the condition is met. For this, check the setting you want to apply using the checkbox. By default, a new style contains one setting – the text color.
In order to create a new condition, click the “Add” button. You will see an expression editor:
Here it is possible to write any expression that returns a boolean result. In many cases you will use the “Value” variable, which contains the current printing value.
Let us look at the following example: we have a “Text” object, in which we print the line amount: [SalesLine.LineAmount]
We want to apply a red color and add a border when the line amount is less than 1000. For this, we create the following condition: Value < 1000. In this case we used the “Value” variable, which has got a printed value. If there are several expressions in an object, then this variable will have the value of the last expression. Instead of “Value”, you can use a data column: [SalesLine.LineAmount] < 1000 Expressions are written in C# style. The report language can be changed in the “Report>Options” menu.
When printing an object which has a value less than 1000, it will be red. Now to add a bit more complexity to our example, we will add another condition. If the line amount is more than 5000, it must be printed green. To do this, open the condition editor and click the “Add” button. The second condition will be like this: Value > 5000
In case where several conditions have been indicated, Document Creator checks all the conditions, starting from the first one. If a certain condition is met, Document Creator applies its style settings to the object, and the process stops. It is important to put the conditions in a correct order. To change the order of the conditions, use the ‘Up’ and ‘Down’ buttons. The result of our highlight conditions now looks like this:
Highlight Odd/Even Data Rows
In order to improve the appearance of a report, you can highlight even data rows in different colors. This can be done by using the “EvenStyle” property of the band or its objects. The property contains a style name, which will be used to highlight even band rows.
Note: It is preferable to use the “EvenStyle” property of the object instead of the band. This avoids possible problems when exporting the report.
In order to configure the highlighting, do the following:
• Define the style, which will be used for highlighting the rows. This can be done in the “Report>Styles” menu.
• Enter the name for the new style in the “EvenStyle” property of the band or its objects.
By default, objects use only the fill property of the style in the “EvenStyle” property. This behavior is defined in the “EvenStylePriority” property – by default it is “UseFill”. If you want to use the rest of the style parameters, set this property to “UseAll”:
Applying this creates the following output:
It is possible to add watermarks to your report. To do this open File>Page Setup>Other>”Edit Watermark”. This opens the following dialog:
There are some pre-defined texts available, but you can also add your own text. Set the color (and transparency), font and rotation you like. Pictures are also supported and can be added next to the text. An example of the watermark is displayed in the preview.
With all described layout settings you could create a report like this:
Document Creator contains lots of possibilities to style your reports in a very easy and user friendly way. No coding or ‘hacks’ involved. Besides the things I described there a lots of other options and settings like; data formatting, visibility expression etc. Some of these will be discussed in upcoming blogs. Examples are also available in the “Document Creator Designer Demo”, which can be found in the demo download on Idyn’s product page.