XSD Styles
An XSD style, that is a style group in a catalog, can hold a large amount of predefined object properties, giving you more control over the appearance and presentation of your report. By using XSD styles, you can create various visual presentation sets from a single report, and change the visual presentation of your report at runtime.
XSD styles are a Logi JReport specific format and not an industry standard so you may want to use CSS styles which are an industry standard.
By simply selecting a style group at runtime, you can change the look and feel of your report in a dramatic way. Logi JReport style groups can be nested, where the parent group is used as a container of other groups. The style group feature makes it easy to save and apply styles without repeatedly designing them each time.
This topic explains how to manage XSD styles using the Style Editor as follows (to display the editor, open the catalog to which you want to add the style groups, then on the Catalog Manager toolbar, select Style).
Below is a list of the sections covered in this topic:
Creating an XSD Style
- In the Style Editor, right-click any of the existing groups and select New Style Group from the shortcut menu to display the New Style Group dialog.
- Enter the name and description of the group, then select OK. A new style group will be added to the tree.
- Right-click the group and select New Style to display the New Style dialog.
- Specify the name, type and description of the new style, then select OK.
The style type indicates the application scope of a style, for example, a style with Label type can only be applied to label objects, and a style with DBField type can only be applied to DBFields.
- In the Save Style dialog, add the properties to be included in the style and change the property values as required.
To add a property, select it from the All Properties box and select . To add all the available properties to the style at a time, select .
To edit the value of a property, select its value cell in the Selected Properties box, then input the new value and press Enter on the keyboard to confirm the change.
To remove a property that has been added, select it from the Selected Properties box and select . To remove all the added properties at a time, select .
- Select Save to add the style to the group.
- Repeat steps 4 to 7 to add more styles to the group.
Now, an XSD style will have been created. You can then apply the style to your reports.
Notes:
- The root of the style group tree can only hold style groups. The styles must reside in the style groups. You cannot create a style directly in the style group tree root.
- You cannot create style groups in the Default style group.
- The name of each style group must be unique in the style group tree.
- Each style has a style type to indicate its application scope, for example, a style with Label type can only be applied to label objects, and a style with DBField type can only be applied to a DBFields.
- You can create more than one style for a style type, and apply different styles to report objects of the same type. For example, suppose that you have a number of DBFields in your report, such as address fields, totals, and quantity fields. You probably will not want all the fields to look the same. You can create two or more styles, using the same style type - DBField, and then apply them separately to the fields that you want to distinguish.
- You can apply a default style to all the objects that hold the same type.
In the Default style group, create a new style, making sure that the style name and style type are the same, for example, style name=Label, style type=Label. Then, modify the style properties. Then, when a new object of the specified type is inserted into the report, the default style will be applied to it automatically. Note that you can see the difference only at runtime.
Modifying an XSD Style
After an XSD style has been set up, you can further modify it in the Style Editor as follows to suit your requirements.
- Duplicating an XSD style in the group tree
- Right-click the style group that your want to duplicate.
- Select Copy Style Group from the shortcut menu.
- Right-click the node where you want to duplicate the style group, and select Paste Style Group. A new group with all styles within it will be duplicated in the tree.
- Editing an XSD style
- Right-click the style group and select Edit Group from the shortcut menu. The Edit Style Group dialog appears.
- In the All Styles List, specify the styles that are to be included in the group, and select to add them to the Selected Styles List (or, you can remove some existing styles from the group by selecting ).
- If you want to create a new style in the group, select the New Style button and specify the properties of the style as required.
- When done, select OK to finish editing.
- Editing a style in an XSD style
- Right-click the style that you want to edit and select Edit Style from the shortcut menu.
- In the Save Style dialog, edit the style as required.
- When done, select OK to apply the changes.
- Removing an XSD style from a catalog
- Right-click the style group that you want to remove and select Delete from the shortcut menu (or press Delete on your keyboard).
- Select OK in the warning message to confirm the removal.
Note: The default XSD style can neither be deleted nor nested.
Editing the XSD Style Files
In addition to editing the styles (style groups) in the Style Editor, you can also edit the XSD format styles (style groups) outside Logi JReport Designer.
When you save a catalog, the style information is saved to disk at the same time. The related files will be located as follows:
File Name | File Description | Location |
---|---|---|
CatalogName_stl.xml | Style Group Structure in the Catalog | Catalog Folder (The directory where the catalog resides) |
StyleGroupName_stl.xsd | Group/Style information | <install_root>\style |
The CatalogName_stl.xml file keeps the style group structure information. The following shows an example:
Style Group Structure in the Catalog Manager | Corresponding Information in SampleReports_stl.xml |
---|---|
<?xml version="1.0" encoding="UTF-8"?> |
The StyleGroupName_stl.xsd file keeps the group/style information, which in the above sample is as follows:
File Content of ClassicBlue_stl.xsd |
---|
As you can see in the above code sample, an XML style group file contains style group information, style information, and the style property entry information. You can edit the attributes of an element.
- To add a style entry, copy and paste the style information section, and then modify the attributes.
- To add a style property entry, copy and paste any element line, and then modify the attributes.
- To delete a style entry or style property entry, select the corresponding section, and delete it.
- To add a new style group, follow the steps below:
- Copy and paste an existing XML style group file.
- Rename it using the required name (Format: GroupName _stl.xsd).
- Change the default attribute in the GroupName element line using the required group name. Make sure that the name is the same as the group name specified in the XML style group file name.
- Add a new line for this group in the CatalogName_stl.xml file. For example, if the new group name is GroupA, you would then insert the following line to the file:
<StyleGroup name="GroupA"></StyleGroup>
- Modify the XML style group file (GroupName_stl.xsd).
- Open the catalog in Logi JReport Designer, and you can see the changes.
Notes:
- The value you type for the default attribute must be consistent with other attributes in the element, and is recognized by Logi JReport Designer.
For example, if you want to change the Font Face property, you must type a proper font name that Logi JReport supports for the default attribute, such as Arial, Times New Roman, Tahoma, and so on. You cannot type strings that are not recognized by Logi JReport. Otherwise, the element will not take effect at runtime.
- Make sure that the GroupName attribute is consistent with the XML style group file name.
For example, with GroupA in the XML file, the GroupName attribute is:
<xs:attribute name="GroupName" type="xs:string" default="GroupA"></xs:attribute>
The XML style group file name should then be GroupA_stl.xsd.