rpe - template formating, style and stylesheet usage

70
Output – Formatting, Style & Output – Formatting, Style & Stylesheet usage Stylesheet usage Bogdan Nistor Reporting Arena Team Member www.reportingarena.com

Upload: gebs-reporting

Post on 28-Jan-2015

179 views

Category:

Technology


11 download

DESCRIPTION

 

TRANSCRIPT

Page 1: RPE - Template formating, style and stylesheet usage

Output – Formatting, Style & Stylesheet usageOutput – Formatting, Style & Stylesheet usage

Bogdan NistorReporting Arena Team Memberwww.reportingarena.com

Page 2: RPE - Template formating, style and stylesheet usage

About the authorAbout the author

2

Reporting Arena is part of Global E-Business Solution Group, an IBM Business Partner that became IBM Software Services Business Partner for Rational Tools in 2010.

Reporting Arena is formed by a large part of the team that developed IBM Rational Publishing Engine, team that also developed and maintained Telelogic DocExpress.

The team has been active in the document generation world for the past 8 years gathering invaluable expertise in the real-world document generation needs.

Page 3: RPE - Template formating, style and stylesheet usage

ServicesServices

3

At Reporting Arena, we specialize in providing enterprise-grade services for publishing needs, by setting up a correct documentation process and adopt it to your organization specific needs.Template Design and Optimization

With many years of first-hand experience in the document generation world, including the development of Rational Publishing Engine, and long exposure to many Data Source repositories and real-world documentation needs we are in a good position to handle complex scenarios including the creation of cross-products documents.

Custom SolutionsRational Publishing Engine is a great solution for document generation needs but there are tasks that require additional capabilities that might not be immediately available in RPE. We provide custom solutions that enable Rational Publishing Engine to fully meet your requirements.

Migration from other document generation technologiesRational Publishing Engine supersedes IBM Rational SoDA and IBM Telelogic DocExpress. Reusing the SoDA and DocExpress templates will not only prevent from wasting the resources spend to create these assets but will also reduce the time needed to create and validate matching RPE assets.

Page 4: RPE - Template formating, style and stylesheet usage

AgendaAgenda

4

Goals

Basics

Prerequisites

Use case

Desired output structure

Implementation Aspects

General rules and best practices

Document Template

Stylesheets

Data sources

First page design & content design

Variables

Styles

Masterpages

Template Content

Template Elements

Data Source items

Formatting

Publishing

Configuring dsx file

Pre-evaluating the outputs

Adjustments and corrections

Viewing the outputs

Conclusion

References

More information

Page 5: RPE - Template formating, style and stylesheet usage

Legend – color and formatting codingLegend – color and formatting coding

5

Current tutorial contains color and font coding for common element types that are used, as described in the table below :

Coded text Used color

Formatting Example Details

RPE template element Paragraph Starts with uppercase character

RPE template element property

bold alignment

RPE template element property value

italic center

Query bold Module/Object

Attribute Object_Text

Dialog name italic New Master Page

Menu item name italic Add Data Source Schema…

Page 6: RPE - Template formating, style and stylesheet usage

GoalsGoals

6

The purpose of this tutorial is to make the user familiar with the process of creating a Style, and to understand the advantages of using a Word and CSS stylesheet for the RPE’s outputs

The tutorial can be useful for anyone is responsible for delivering custom layouts for data reports

We will see how a style in RPE is visible in different output formats, the way in which direct RPE element properties overwrite Style properties, and the way that Styles from RPE template and the ones from stylesheet are handled, merged etc.

Formatting, styling, and template design will add big improvements in the way that data is delivered, to be understandable by the end user

At the end of the tutorial, the user shall be able to create it’s own Style according to its needs, to edit and to assign custom stylesheets to the Word or Html output, stylesheets that can contain Style definitions, etc.

Page 7: RPE - Template formating, style and stylesheet usage

BasicsBasics Style : set of pre-defined formatting instructions that you can use repeatedly

throughout a document. Advantages : Consistency — When you use styles to format your document, each section is formatted

the same and therefore, provides a professional, clean-looking document Easier to Modify — If you use styles in your document consistently, you only need to

update a given style once if you want to change the characteristics of all text formatted in that style

Efficiency — You can create a style once, and then apply it to any section in the document without having to format each section individually. Allow for quick formatting modifications throughout the document

Table of Contents — Styles can be used to generate a table of contents quickly

Stylesheet : collection of styles, layout settings. Advantages : Consistency – the document shall have same formatting and look from start to end Easier to Modify – making a change within the stylesheet reflects on the new generated

documents that are based on it

7

Page 8: RPE - Template formating, style and stylesheet usage

PrerequisitesPrerequisites

8

Products : Windows XP/Vista/7 Rational Publishing Engine 1.1.1.2 or later IE/Firefox (to visualize Html output) Microsoft Word 2003/2007 (to visualize the Word output) Adobe Reader (to visualize the Pdf output) XslFo viewer (e.g. Antenna House)

Basic knowledge : RPE template design Understanding for XML structure Word&CSS styles

Page 9: RPE - Template formating, style and stylesheet usage

Use caseUse case

9

We’re going to consider the following example: An employee from an Automobile Manufacturer has to create a small report that contains

basic data regarding a car project requirements. This report has to take out in evidence specific information regarding the comfort and

safety of the car that will be one day available on the market The report must be properly arranged and easy to parse

Page 10: RPE - Template formating, style and stylesheet usage

Desired Output StructureDesired Output Structure The output must have :

10

Title page with suggestive image and document title

Colors, to help the reader in comprehend what is reading

Table of contents for resume and easy navigation

Header and a footer for document content with specific company logos

Default page format for every output type (margins, page background, missing page

borders etc)

Page numbers

Page 11: RPE - Template formating, style and stylesheet usage

Desired Output StructureDesired Output Structure The output must have :

11

Numbered styled headings to make the

document more readable and memorable

Alternate formats for rows, to make tables easier to

parse

Highlights on information that is important for target

user

Page arrangement for intelligibility and presentable look

Page 12: RPE - Template formating, style and stylesheet usage

Before the work is started, is better to have an “image” in mind for what needs to be obtained

Minimize the amount of work by taking advantage of RPE tools (e.g. Style elements). Also consider external sources of help, like stylesheets.

Do not work on huge data sources : try to minimize the amount of time required for getting the outputs, so configure your dsx file with small data sources or dummy data, and run the template from time to time, to make sure that, when you will run the template over the big data source, you won’t need to make template changes and re-run the template. You will save a lot of time.

Create styles when same properties must be applied for more than one element.

12

Page 13: RPE - Template formating, style and stylesheet usage

Document templateDocument template Stylesheets

For the current template, there is the need for numbered headings on the Word output. The easy way of having this is by using a Word stylesheet. You can take a brief look below if you want to create the stylesheet from scratch, or else, we will see in the future how we will use the one from the tutorial’s resources folder.Open Word application and define a multilevel listMake sure you make the assignments as they are displayed in the screenshot, no matter if you use Word 2003 or Word 2007Save the document as a 2003 dot file.

In the resources folder there is the cssStylesheet.css that will be used at the appropriate time, in this presentation, for the Html output.

13

Page 14: RPE - Template formating, style and stylesheet usage

Document templateDocument template Data sources

Current template shall be populated with loads of data from an xml source : the schema must be added to the template. Open RPE studio Add a data source schema. Select Generic XML as schema type, then click Browse button to select the corresponding xsd schema file for the xml data source. Select the schema that comes with this tutorialThe data source schema is added in the corresponding window tab, down below the Palette window. The tab contains the name of the data source, and the expandable tree represents the xml data source structure that shall be used to extract elements with the RPE template

14

Page 15: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page designWithin this tutorial, the title page will contain the document title, and an image related with the company’s

profile. Also there will be an interrupted border that will surround this content by highlighting the table corners.

These objects must be arranged within a page content at specific position, thus we’ll use a Table element : Create a Table into the template area By default, the number of rows is set to 1, and the number of columns is 2. But here we need a

3x3 table : the reason will be explained in the next slides. So for now, set the rows number to 3, and the column number to 3 also.

15

Now, as the RPE template has content, it can be saved. So you can save the template at this time at desired location, and give it a name, e.g. “tutorial.dta”.

Page 16: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page design

The Table element you’ve just created will hold the title elements, so it must be centered, to have it arranged within page :select the Table from the RPE template area, then go to the Properties tab. Set the table auto fit property to autofit to window :

16

The table content can be now inserted. As we saw in the “Desired Output Structure” chapter, we need a title, and this will be extracted from the Module query: it is about the Name attribute. As it can be seen in the data source, the title is composed by two words. We will extract this title in the 1st cell within 2nd row, and we’ll break it to appear in two text lines.

Page 17: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page design

Create a Container element into 1 st cell of the 2nd row, then a Paragraph element into the Container. Drag the Module query over the Container

Create an internal variable called varModuleName. This variable will contain the document title, modified to be displayed over two lines. It will be used within the Paragraph element, but also, in Masterpage’s Header, that we’ll create later on.

17

Page 18: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page design

Right click over the Paragraph element, and make the assignment described below, for the varModuleName variable. The script will split the title into two lines :

18

Drag the varModuleName into the Paragraph element, to have the title placed there, in the 1st cell within 2nd row.

Page 19: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page design

We need to have a styled title, with custom formatting, so right click again over the Paragraph, and select the Title Style :

19

The title should be “moved” to the center of the page, so for this, we’ll set the Cell’s property cell alignment to center right.

Page 20: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page design

Adding the image to the title page : Create an Image element in the 2nd cell of the 2nd Table Row. Right click inside the Image element.

Select Image/Load image… option, to search for the car image.

20

Locate the file, and from the folder that comes with this tutorial, select the car.jpg file.

Page 21: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page design

The Image is now inserted; as this Image has big dimensions, we’re going to adjust this by setting the image max width property to the value of 220, that is about 3 inches (Note that 1 inch = 72 points, and image max width is measured in points) :

21

The last Cell in this Row will have no content, so it can be merged with the middle Cell. For this, select the Cell that contains the Image, and set the col span property to 2. This tells the current Cell to merge with the next one.

Page 22: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page design

Every Cell that is situated near the Table corners will have custom borders. These cells will group the title and the Image, to “highlight” the table content.Select the top left Cell from the Table, and edit the border properties as they appear in the attached screenshot

22

Make similar settings for : top right Cell (set top and right border) bottom right Cell (set right and bottom border) bottom left Cell (set bottom and left border)

Remove Cell’s border properties set at table level, to keep only the previously custom Cell borders

Page 23: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page design

The 1st and 3rd Row will have cells with borders on their left and right sides, but due the fact that these rows have no content, the vertical borders of the cells will be small, equal with the height of the default font size. This can be enhanced by modifying the Row height.Select the Style/New style… menu, to create a new Style for the 1st and 3rd RowSet the StyleRowHeight name for the StyleMove forward in the Style creation wizard and add the Row elementSet the row height property to the value of 10 units

23

Press Next and finish the wizard

Page 24: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page design

Assign the created Style to 1st and 3rd Row

24

Setting the Row height thru the created Style makes the difference between left and right screenshot below :

Page 25: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page design

It is useful, from time to time, to publish your template, to check out if the results are as you expect them to be. You can use the Preview button for this. For details, consult the “Publishing - Configuring dsx file” chapter.Press the Preview buttonFrom the result dialog, open the Word output.The output file is displayed and should look like the one below, if you open it in Word 2007. Note that some adjustments must be made for the vertical and horizontal align of the page content.

25

Page 26: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page design

Going back to the template, to make the necessary adjustments Select the Table within the template, and check out the table alignment property. Set the center

value to have the Table centered. To have this alignment uniform in all outputs (Html output requires special handling for having

similar alignment in IE and Firefox), create a Paragraph element and drag the Table in it, and set the paragraph alignment to center :

26

Page 27: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page design

At last, the vertical position in page must be handled : Vertical alignment can be solved in two ways, but only by using a Masterpage. So create a new

Masterpage element called MPTitle.

27

Press the mouse button within Masterpage area, elsewhere than the Header or Footer. After you do this, the Masterpage properties are loaded into the Properties tab. Expand the Formatting three until the top page margin property is reached. Set the value to 260. This tells to RPE to take in consideration a distance of 260 points from the top side of the page. The value can be adjusted experimentally, after a few runs.

Page 28: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page design

Change the view by clicking in the correct tab at the bottom of the template area :

28

The Masterpage must be assigned to the Paragraph that holds the Table. Right click over the Table. Select the submenu Master Page, and then the item MPTitle.

Page 29: RPE - Template formating, style and stylesheet usage

Document templateDocument template First page design

The necessary modifications have been made, so save the template and publish it with the Preview option. Your Word output should look at this point like the one below. The first page design seems to be finished.

29

Page 30: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

The content of the output document will laid on a few pages, so easy navigation is useful. For this, a Table of Contents elements must be used.Create a Table of Contents element after the section that holds first page elements.

30

If the Table of Contents will start to be written right after that Table, it wouldn’t look very nice, so we will create a Masterpage for the output document content. The Masterpage for the content will have the same Image that is present in the title page, the document title, and the page number element.Create a new Masterpage with the name MPContent.Create a Table with two cells in the Header, and a similar one in the Footer, useful to arrange the contents.

Page 31: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Select the Table in Header to customize the layout of it. Modify the table auto fit property : we want to have a Table that

occupies the entire page surface, from the left margin to the right margin, so we set the autofit to window value.

Set the bottom border of the table, to have a line between header and page content. For this, type in 000000 for the bottom border color, single for the bottom border style and 1 for bottom border width.

Having cell borders isn’t desired in here, so the corresponding properties values shall be deleted. Erase the value for all cell borders color property, all cell borders style and all cell borders width.

31

With the Table in the Footer element selected, make the same modifications as for the previous Table, regarding cell borders. As for the Table borders, this time modify the top ones; and do not forget to set the table auto fit property.

Page 32: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Now we add the content for the Table in Header : Create an Image element in the 1st Cell from 1st Row, and load the same image that is present in the

first document page. As the Image is situated in the Header area, scale it down by setting the image max width to the

value of 72.

32

For the parent Cell, set cell alignment to bottom left, because we want the Image to be situated near the left and bottom side of the Header.

Page 33: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Create a new Style for the Cell element, called StyleCellPadding, and set the all cell paddings property to the value of 3.

33

Assign the new created Style to the 2nd Cell for the Table inside the Header, in order to have certain distance between the Cell content and the Table edges. Do the same operation in the Footer too.

Page 34: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Drag the varModuleName variable inside 2nd Cell within 1st Row, because we want the module name to be there also

In the 2nd Cell within 1st Row inside the Footer, create a Page Number element, to have the document pages numbered.

Set the cell alignment to bottom right for 2nd Cell inside header, and top right for 2nd Cell inside Footer.

The Masterpage should look like the one below :

34

Page 35: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Move back to the template content, and assign the MPContent Masterpage to the Table of Contents element. From that point on, all pages will have same Header and Footer.

Insert Container elements as shown in the figure below. Modify the name of the 1st Container to target user assignment, by setting the name property in the Metadata branch for Container’s Properties window. The containers are needed here to specify the points where decisions must be made regarding the contents of the output document that will be generated.

35

Create the following external variables : var1, varSearchedWord, varUser. You will see the role of each on the next slides. What needs to be noted here is that the report must be easy to be obtained for different users.

Page 36: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Create a condition for the first child Container as shown below. The runtime flow will pass thru this condition when the report will be generated for the Simon user.

36

For the Container below the one you’ve just set the condition, set a similar condition, but use the David name instead

Page 37: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Select the child Container for Simon, and make the assign between comfort keyword and the varSearchedWord. We suppose that within the extracted data, this word often appears, and for the Simon employ, it is a point of interest for his tasks.

Make similar assignment for the child Container within David’s, but in this case, David is interested about safety in general, so we will use the safe tag in this case. Check out below :

37

Page 38: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

The varUser variable is used within containers conditions, but is never assigned. So first, we can suppose that we are interested about Simon requests :Make an assignment between varUser and the Simon name, for the Container that is named target user assignment, like below (the assignment can be also made by selecting the varUser variable from the Outline view, and then setting the Default value property) :

38

Page 39: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Let’s move on to build the template structure that will extract the data from the xml file. Create a Container element, that has a Paragraph and two Containers in it.

39

The parent Container will have the necessary query to parse all objects from the data source. To make things more clear, take in consider the way the xml file is organized, as shown below.

Page 40: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Drag the Module/Object query to the parent Container, and Module/Object/Table to the last Container within this parent Container; we need to extract data from xml objects, but from xml objects that hold xml tables also.

40

We want to have heading elements in the first Paragraph, and Text elements in the first Container. But if those elements have no content in the xml file, there is no need to evaluate them within RPE template. So conditions must be set for solving this; set the following condition Object_Heading != “” for the Paragraph, and Object_Text != “” for the first Container.

Drag the Object Heading attribute to the Paragraph content.

Page 41: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

First Container after the Paragrah element will be used for extracting Object Text data. As we want to have different format settings depending on the searched word filtering, we will insert two Containers in the second one. Insert the following condition for evaluating their content :Object_Text.toLowerCase().indexOf(varSearchedWord, 0) == -1 for the first Container, meaning that the processing inside it can continue if the searched word is not found

41

Object_Text.toLowerCase().indexOf(varSearchedWord, 0) != -1 for the second Container, meaning that the processing continues inside it when the searched word is within the Text element content that comes from the xml file, so data extracted here must be highlighted somehow to be more visible to the user that will read the resulting report.

Page 42: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Insert a Paragraph element in the Container where the Text is to be displayed when the searched word is not found, and simply drag the Module/Object/Object Text in it.

42

Create a Paragraph in the Container that handles the searched data, and create an Image inside it and two Text elements. Edit the first Text content to have a space, and for the second Text, drag the Module/Object/Object Text attribute.

Page 43: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Load the exclamation_mark.jpg image into the RPE Image element. The file is located into the resources folder that comes with this tutorial. This will be useful for a fast visual identification of the phrases that contain the searched word.

43

Create now two styles, one for the Image element, and one for the 2nd Text element. The Style for the Image, called Style Icon shall have Image properties, where image max height is

set to 12, because we do not want a huge Image inline with the following Text elements.

Page 44: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

The Style for the Text element, called StyleSpecificTask shall have two Text properties set, the bold set on true and font color set with the value cf0000.

After creating those styles, assign StyleIcon for the Image, and StyleSpecificTask for the Text with the Object Text attribute assigned :

44

At this time, the texts from xml text type elements are handled, but not the ones from the xml table elements. Remember that there are a lot of table elements in the xml source file :

Page 45: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

The same filtering criteria must be set over the text content that will be extracted from tables within xml source.Within the Container that holds the Module/Object/Table query insert the following RPE elements, considering that every element from the following string is a parent for the next one : Table->Container->Row->Cell. In the Cell element, insert two Containers, one for the Text that will hold phrases with the searched word, and one for all others.

45

Drag queries as shown below. The purpose of using Containers is to avoid inserting empty Tables or empty Rows, so a Table or a Row is drawn only if it exists :

Page 46: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Insert the Module/Object/Table/Row/Object/Object Text attribute in the first Container, and the exclamation_mark.jpg image, the space character text, and the Module/Object/Table/Row/Object/Object Text attribute in the second Container, as we did a few slides above, when parsing object elements. Also, assign the StyleIcon for the Image, and StyleSpecificTask for the attribute text inside the second Container.

46

Page 47: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Next, add the conditions for evaluating the contents of the Cell containers, the same conditions that where used in the two Containers that handled the texts from xml object elements described on previous slides : Object_Text.toLowerCase().indexOf(varSearchedWord, 0) == -1 for the first Container, and Object_Text.toLowerCase().indexOf(varSearchedWord, 0) != -1 for the second Container. Make sure you select the correct Object Text attribute when you set the scripted conditions :

47

Page 48: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Assign the following script for the Container that has the Row iteration query assigned : ++var1, so that this variable will hold the number of the current Row. The _row_number variable can also be used instead (var1 was introduced to notify variables usage).

48

Page 49: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

We need a Style for the first Row within a Table, also called a header Row. So create one and call it StyleRowRepeat, and add a Row element in the Style definition. Edit the following properties : all caps on true, font color on 4f8fcf.

Create a Style for the Cells that will be situated in the header Row, and call it StyleHeaderCell. Add a Cell and a Text element in the Style definition, within the Style creation wizard. Edit the following properties : all borders color to 00, all borders style to single, all borders width to 2, cell background color to DFEFFF. For the Text element branch, edit the property bold to true. You will note, when the output will be published, that the font settings within this Style will be merged with the font settings from the StyleRowRepeat.

Assigning those styles to the Row and Cell element cannot be made directly, because within the Table there is just one Row, and just one Cell, and those are iterated.

49

Page 50: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

There is the need for a script based assignment for the styles created earlier, StyleRowRepeat and StyleHeaderRow. Select the Row, click the button from the style name property box within Properties window, and create the following script expression which tells to RPE to assign the StyleRowRepeat only for the first Cell.

50

Page 51: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

Another script must be set for the row repeat at page beginning property for the Row. By default, the property is set to false, because only the first Row can be drawn every time a Table is split at the end of a page, in order to be continued from the beginning of the following page with that first Row (header Row). With the script attached below, this behavior is transmitted to RPE in order to handle it at runtime.

51

Page 52: RPE - Template formating, style and stylesheet usage

Document templateDocument template Content design

A script must be assigned also for the Cell element, because the StyleHeaderCell must be assigned only for the Cells from the first Row. This decision can be made again by reading the var1 variable value, that is changed only when a Row is reached, as you remember from previous slides, when we made the var1 increment operation within the Row’s parent (the Container element).

52

Page 53: RPE - Template formating, style and stylesheet usage

PublishingPublishing Configuring dsx file

Run your template by using the Preview or Run option, to make sure that the template design was correct :If the RPE Launcher is missing from the RPE environment, open its perspective.Usually, the template is automatically added to current dsx file. The little star near the Document Specification tab title notifies that the current dsx file is not saved.

53

If your tab does not look like the one displayed above, select File/New/Document Specification, and a new dsx file will be created.

Going further, the template you’ve created must be added to the templates list of the document specification file. Search and select your template in the browser window; your dsx structure should look now like the first screenshot from the current slide.

Page 54: RPE - Template formating, style and stylesheet usage

PublishingPublishing Configuring dsx file

Select the xml data source and type the URI to the xml file called source.xml, or locate it in the resources folder within tutorial location, by pressing the browse button from the URI text box within Properties tab, as shown below in the figure on the left side.

Select every target output, and type the full path for the files that will be generated (figure on right side). Do not forget to type the file names with extensions also. If you type folders that do not exist, they will be created at runtime.

54

Page 55: RPE - Template formating, style and stylesheet usage

PublishingPublishing Configuring dsx file

With the RPE Launcher window active, press Ctrl+S, in order to save the document specification file, and save it to the desired location.

Hit the Preview or the Run button to generate output documents; a dialog pops-up showing you that the publishing process runs.

55

Also, the console view notifies from time to time about what is happening in the background. It should take no more than a few tens of seconds, because the data source is a small one.

When the runtime is finished, an explicit message is displayed, and the result dialog is displayed. It contains the links for the output documents that were created by RPE.

Page 56: RPE - Template formating, style and stylesheet usage

PublishingPublishing Run report

Open the output files :

56

Page 57: RPE - Template formating, style and stylesheet usage

PublishingPublishing Pre-evaluating the outputs

Taking a brief look at each output, you will note the following : In the Word output :

Headings are not numbered The table of contents and main content are in the same page; if the main content would start in

a new page, it would look better Table of contents items could have a custom Style with similar colors as the ones used in the

template Table of contents contains the Title styled words also

57

Page 58: RPE - Template formating, style and stylesheet usage

PublishingPublishing Pre-evaluating the outputs

In the Html output : The title could be enhanced with a CSS style applied

58

The rows could have alternate Style, depending on their parity : it is a common way of displaying tables in Html, and this could be applied to all outputs with a Style and an appropriate script.

Page 59: RPE - Template formating, style and stylesheet usage

PublishingPublishing Pre-evaluating the outputs

In the XslFo output : As in the Word output, the main content is in the same page as the table of contents items

59

In the Pdf output, as you can see in your output.pdf result, there are no special situations that require modifications.

Page 60: RPE - Template formating, style and stylesheet usage

PublishingPublishing Adjustments and corrections

Go back to the RPE template and make the following modifications : Assign the MpContent Masterpage to the target user assignment Container, and set the force page

change property on true. This will ensure that the main content will start on a new page with same Masterpage.

60

Edit the code for the Table of Contents element to \o "2-9" \h \z \t "Heading 1,1” , in order to have the headings references only. Set the heading level to 9, to have all possible headings referenced. Make the font settings font color to 4f8fcf and font size to 12 to change the way TOC items look :

Page 61: RPE - Template formating, style and stylesheet usage

PublishingPublishing Adjustments and corrections

To have heading numbers in the Word output, please specify the stylesheet path for the Word target, in the dsx configuration file. The stylesheet.dot file is located in the resources folder for this tutorial. After you will run the report again, if you do not like the heading indents, heading styles or numberings, you can customize the stylesheet as you want.

61

Page 62: RPE - Template formating, style and stylesheet usage

PublishingPublishing Adjustments and corrections

For the Html output, assign the cssStylesheet.css file path to the stylesheet property of the Html target, within the dsx file. There are three css classes in there :

the Title class will overwrite and merge with the Title Style from the RPE template, and thus the text title will be modified to fit more properly in the Html layout

the class “table” for the table element will be applied on all tables within output, tables that will have now a smaller sized text

the class “td” for cell will be applied on all cells, and thus the text will have a certain padding distance between it and cell borders, and the vertical align will be “center”.

62

Page 63: RPE - Template formating, style and stylesheet usage

PublishingPublishing Adjustments and corrections

Create a new Style, and call it StyleCellAlternate. Put the Cell element in the Style definition, and set the cell background color to CFEEFF.

Edit the Style name property for the Cell that iterates corresponding objects from the xml data source, with the following script, displayed below; this will assign the StyleCellAlternate for the objects with numbers 3, 5, 7 … etc.

63

Page 64: RPE - Template formating, style and stylesheet usage

PublishingPublishing Viewing the outputs

Run the template again : all required modifications should be now visible. Word headings are now numbered (Word output below)

64

Table of contents is not on the same page with the main content (Word output below)

The words that have Title Style are not present anymore within table of contents references, and these references have now custom formatting (Word output below)

Page 65: RPE - Template formating, style and stylesheet usage

Rows have now alternate styles, depending on their number parity. The table is now more readable. (Html output below; the other outputs are having this set also)

PublishingPublishing Viewing the outputs

The text with Title Style looks better now in Html, as it has applied the properties from the CSS “Title” class. (Html output below)

65

Page 66: RPE - Template formating, style and stylesheet usage

PublishingPublishing Viewing the outputs

In XslFo, Word, Pdf, the content is not on the same page with the Table of Contents element (XslFo output below)

66

Page 67: RPE - Template formating, style and stylesheet usage

If you change the varUser value, you’ll get phrases for the safe tag highlighted.

PublishingPublishing Viewing the outputs

Check for the extracted data. Note that the paragraphs that contain the comfort word (review slide 36 to remember the filtering

conditions), are highlighted in red.

67

Page 68: RPE - Template formating, style and stylesheet usage

ConclusionConclusion The results are good, so the current tutorial can serve as a model for extracting and customizing data from larger data sources; more complex filtering can be set, more

styles can be added etc. Styles are used in RPE to enhance speed and usability Styles in RPE can be used in combination with CSS classes, and regarding Word stylesheet, keep in mind that a style from it overwrites the RPE Style. Styles in RPE do not have a type, so you can use any Style on any element, but is recommended that you assign the Style to an element type that is equivalent with the

element that has the properties set within the Style definition. Also, to avoid misunderstandings regarding applied properties, insert a single element in a Style definition.

68

Page 69: RPE - Template formating, style and stylesheet usage

ReferencesReferences RPE help reference Field codes : http://office.microsoft.com/en-us/word-help/field-codes-in-word-

HA010100426.aspx Styles in Word : http://office.microsoft.com/en-us/word-help/style-basics-in-word-

HA010230882.aspx CSS basics : http://www.w3schools.com/css/default.asp Color codes : http://html-color-codes.info Javascript : http://www.javascriptkit.com/javatutors/ ; http://www.learn-javascript-tutorial.com/

69

Page 70: RPE - Template formating, style and stylesheet usage

More informationMore information More tutorials and video lessons : www.reportingarena.com Questions, observations, feedback : [email protected]

70