RPE - Template formating, style and stylesheet usage


Published on

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

RPE - Template formating, style and stylesheet usage

  1. 1. Output – Formatting, Style & Stylesheet usage Bogdan Nistor Reporting Arena Team Member www.reportingarena.com
  2. 2. About the author <ul><li>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. </li></ul><ul><li>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. </li></ul><ul><li>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. </li></ul>
  3. 3. Services <ul><li>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. </li></ul><ul><li>Template Design and Optimization </li></ul><ul><ul><li>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. </li></ul></ul><ul><li>Custom Solutions </li></ul><ul><ul><li>Rational 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. </li></ul></ul><ul><li>Migration from other document generation technologies </li></ul><ul><ul><li>Rational 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. </li></ul></ul>
  4. 4. Agenda <ul><li>Goals </li></ul><ul><li>Basics </li></ul><ul><li>Prerequisites </li></ul><ul><li>Use case </li></ul><ul><li>Desired output structure </li></ul><ul><li>Implementation Aspects </li></ul><ul><ul><li>General rules and best practices </li></ul></ul><ul><li>Document Template </li></ul><ul><ul><li>Stylesheets </li></ul></ul><ul><ul><li>Data sources </li></ul></ul><ul><ul><li>First page design & content design </li></ul></ul><ul><ul><ul><li>Variables </li></ul></ul></ul><ul><ul><ul><li>Styles </li></ul></ul></ul><ul><ul><ul><li>Masterpages </li></ul></ul></ul><ul><ul><ul><li>Template Content </li></ul></ul></ul><ul><ul><ul><ul><li>Template Elements </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Data Source items </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Formatting </li></ul></ul></ul></ul><ul><li>Publishing </li></ul><ul><ul><li>Configuring dsx file </li></ul></ul><ul><ul><li>Pre-evaluating the outputs </li></ul></ul><ul><li>Adjustments and corrections </li></ul><ul><li>Viewing the outputs </li></ul><ul><li>Conclusion </li></ul><ul><li>References </li></ul><ul><li>More information </li></ul>
  5. 5. Legend – color and formatting coding 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…
  6. 6. Goals <ul><li>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 </li></ul><ul><li>The tutorial can be useful for anyone is responsible for delivering custom layouts for data reports </li></ul><ul><li>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. </li></ul><ul><li>Formatting, styling, and template design will add big improvements in the way that data is delivered, to be understandable by the end user </li></ul><ul><li>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. </li></ul>
  7. 7. Basics <ul><li>Style : set of pre-defined formatting instructions that you can use repeatedly throughout a document. Advantages : </li></ul><ul><ul><li>Consistency  — When you use styles to format your document, each section is formatted the same and therefore, provides a professional, clean-looking document </li></ul></ul><ul><ul><li>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 </li></ul></ul><ul><ul><li>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 </li></ul></ul><ul><ul><li>Table of Contents  — Styles can be used to generate a table of contents quickly </li></ul></ul><ul><li>Stylesheet : collection of styles, layout settings. Advantages : </li></ul><ul><ul><li>Consistency – the document shall have same formatting and look from start to end </li></ul></ul><ul><ul><li>Easier to Modify – making a change within the stylesheet reflects on the new generated documents that are based on it </li></ul></ul>
  8. 8. Prerequisites <ul><li>Products : </li></ul><ul><ul><li>Windows XP/Vista/7 </li></ul></ul><ul><ul><li>Rational Publishing Engine or later </li></ul></ul><ul><ul><li>IE/Firefox (to visualize Html output) </li></ul></ul><ul><ul><li>Microsoft Word 2003/2007 (to visualize the Word output) </li></ul></ul><ul><ul><li>Adobe Reader (to visualize the Pdf output) </li></ul></ul><ul><ul><li>XslFo viewer (e.g. Antenna House) </li></ul></ul><ul><li>Basic knowledge : </li></ul><ul><ul><li>RPE template design </li></ul></ul><ul><ul><li>Understanding for XML structure </li></ul></ul><ul><ul><li>Word&CSS styles </li></ul></ul>
  9. 9. Use case <ul><li>We’re going to consider the following example: </li></ul><ul><ul><li>An employee from an Automobile Manufacturer has to create a small report that contains basic data regarding a car project requirements. </li></ul></ul><ul><ul><li>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 </li></ul></ul><ul><ul><li>The report must be properly arranged and easy to parse </li></ul></ul>
  10. 10. Desired Output Structure <ul><li>The output must have : </li></ul>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
  11. 11. Desired Output Structure <ul><li>The output must have : </li></ul>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
  12. 12. <ul><li>Before the work is started, is better to have an “image” in mind for what needs to be obtained </li></ul><ul><li>Minimize the amount of work by taking advantage of RPE tools (e.g. Style elements). Also consider external sources of help, like stylesheets. </li></ul><ul><li>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. </li></ul><ul><li>Create styles when same properties must be applied for more than one element. </li></ul>
  13. 13. Document template <ul><li>Stylesheets </li></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>Open Word application and define a multilevel list </li></ul></ul><ul><ul><li>Make sure you make the assignments as they are displayed in the screenshot, no matter if you use Word 2003 or Word 2007 </li></ul></ul><ul><ul><li>Save the document as a 2003 dot file. </li></ul></ul><ul><ul><li>In the resources folder there is the cssStylesheet.css that will be used at the appropriate time, in this presentation, for the Html output. </li></ul></ul>
  14. 14. Document template <ul><li>Data sources </li></ul><ul><ul><li>Current template shall be populated with loads of data from an xml source : the schema must be added to the template. </li></ul></ul><ul><ul><li>Open RPE studio </li></ul></ul><ul><ul><li>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 tutorial </li></ul></ul><ul><ul><li>The 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 </li></ul></ul>
  15. 15. Document template <ul><li>First page design </li></ul><ul><li>Within 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. </li></ul><ul><li>These objects must be arranged within a page content at specific position, thus we’ll use a Table element : </li></ul><ul><ul><li>Create a Table into the template area </li></ul></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>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”. </li></ul></ul>
  16. 16. Document template <ul><li>First page design </li></ul><ul><ul><li>The Table element you’ve just created will hold the title elements, so it must be centered, to have it arranged within page : </li></ul></ul><ul><ul><li>select the Table from the RPE template area, then go to the Properties tab. Set the table auto fit property to autofit to window : </li></ul></ul><ul><ul><li>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 1 st cell within 2 nd row, and we’ll break it to appear in two text lines. </li></ul></ul>
  17. 17. Document template <ul><li>First page design </li></ul><ul><ul><li>Create a Container element into 1 st cell of the 2 nd row, then a Paragraph element into the Container. </li></ul></ul><ul><ul><li>Drag the Module query over the Container </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  18. 18. Document template <ul><li>First page design </li></ul><ul><ul><li>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 : </li></ul></ul><ul><ul><li>Drag the varModuleName into the Paragraph element, to have the title placed there, in the 1 st cell within 2 nd row. </li></ul></ul>
  19. 19. Document template <ul><li>First page design </li></ul><ul><ul><li>We need to have a styled title, with custom formatting, so right click again over the Paragraph, and select the Title Style : </li></ul></ul><ul><ul><li>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 . </li></ul></ul>
  20. 20. Document template <ul><li>First page design </li></ul><ul><ul><li>Adding the image to the title page : </li></ul></ul><ul><ul><li>Create an Image element in the 2 nd cell of the 2 nd Table Row. Right click inside the Image element. Select Image/Load image… option, to search for the car image. </li></ul></ul><ul><ul><li>Locate the file, and from the folder that comes with this tutorial, select the car.jpg file. </li></ul></ul>
  21. 21. Document template <ul><li>First page design </li></ul><ul><ul><li>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) : </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  22. 22. Document template <ul><li>First page design </li></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>Select the top left Cell from the Table, and edit the border properties as they appear in the attached screenshot </li></ul></ul><ul><ul><li>Make similar settings for : </li></ul></ul><ul><ul><ul><li>top right Cell (set top and right border) </li></ul></ul></ul><ul><ul><ul><li>bottom right Cell (set right and bottom border) </li></ul></ul></ul><ul><ul><ul><li>bottom left Cell (set bottom and left border) </li></ul></ul></ul><ul><ul><li>Remove Cell’s border properties set at table level, to keep only the previously custom Cell borders </li></ul></ul>
  23. 23. Document template <ul><li>First page design </li></ul><ul><ul><li>The 1 st and 3 rd 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. </li></ul></ul><ul><ul><li>Select the Style/New style… menu, to create a new Style for the 1 st and 3 rd Row </li></ul></ul><ul><ul><li>Set the StyleRowHeight name for the Style </li></ul></ul><ul><ul><li>Move forward in the Style creation wizard and add the Row element </li></ul></ul><ul><ul><li>Set the row height property to the value of 10 units </li></ul></ul><ul><ul><li>Press Next and finish the wizard </li></ul></ul>
  24. 24. Document template <ul><li>First page design </li></ul><ul><ul><li>Assign the created Style to 1 st and 3 rd Row </li></ul></ul><ul><ul><li>Setting the Row height thru the created Style makes the difference between left and right screenshot below : </li></ul></ul>
  25. 25. Document template <ul><li>First page design </li></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>Press the Preview button </li></ul></ul><ul><ul><li>From the result dialog, open the Word output. </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  26. 26. Document template <ul><li>First page design </li></ul><ul><ul><li>Going back to the template, to make the necessary adjustments </li></ul></ul><ul><ul><li>Select the Table within the template, and check out the table alignment property. Set the center value to have the Table centered. </li></ul></ul><ul><ul><li>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 : </li></ul></ul>
  27. 27. Document template <ul><li>First page design </li></ul><ul><ul><li>At last, the vertical position in page must be handled : </li></ul></ul><ul><ul><li>Vertical alignment can be solved in two ways, but only by using a Masterpage. So create a new Masterpage element called MPTitle . </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  28. 28. Document template <ul><li>First page design </li></ul><ul><ul><li>Change the view by clicking in the correct tab at the bottom of the template area : </li></ul></ul><ul><ul><li>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 . </li></ul></ul>
  29. 29. Document template <ul><li>First page design </li></ul><ul><ul><li>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. </li></ul></ul>
  30. 30. Document template <ul><li>Content design </li></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>Create a Table of Contents element after the section that holds first page elements. </li></ul></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>Create a new Masterpage with the name MPContent . </li></ul></ul><ul><ul><li>Create a Table with two cells in the Header, and a similar one in the Footer, useful to arrange the contents. </li></ul></ul>
  31. 31. Document template <ul><li>Content design </li></ul><ul><ul><li>Select the Table in Header to customize the layout of it. </li></ul></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>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 . </li></ul></ul><ul><ul><li>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 . </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  32. 32. Document template <ul><li>Content design </li></ul><ul><ul><li>Now we add the content for the Table in Header : </li></ul></ul><ul><ul><li>Create an Image element in the 1 st Cell from 1 st Row, and load the same image that is present in the first document page. </li></ul></ul><ul><ul><li>As the Image is situated in the Header area, scale it down by setting the image max width to the value of 72 . </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  33. 33. Document template <ul><li>Content design </li></ul><ul><ul><li>Create a new Style for the Cell element, called StyleCellPadding, and set the all cell paddings property to the value of 3 . </li></ul></ul><ul><ul><li>Assign the new created Style to the 2 nd 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. </li></ul></ul>
  34. 34. Document template <ul><li>Content design </li></ul><ul><ul><li>Drag the varModuleName variable inside 2 nd Cell within 1 st Row, because we want the module name to be there also </li></ul></ul><ul><ul><li>In the 2 nd Cell within 1 st Row inside the Footer, create a Page Number element, to have the document pages numbered. </li></ul></ul><ul><ul><li>Set the cell alignment to bottom right for 2 nd Cell inside header, and top right for 2 nd Cell inside Footer. </li></ul></ul><ul><ul><li>The Masterpage should look like the one below : </li></ul></ul>
  35. 35. Document template <ul><li>Content design </li></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>Insert Container elements as shown in the figure below. Modify the name of the 1 st 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. </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  36. 36. Document template <ul><li>Content design </li></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>For the Container below the one you’ve just set the condition, set a similar condition, but use the David name instead </li></ul></ul>
  37. 37. Document template <ul><li>Content design </li></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>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 : </li></ul></ul>
  38. 38. Document template <ul><li>Content design </li></ul><ul><ul><li>The varUser variable is used within containers conditions, but is never assigned. So first, we can suppose that we are interested about Simon requests : </li></ul></ul><ul><ul><li>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) : </li></ul></ul>
  39. 39. Document template <ul><li>Content design </li></ul><ul><ul><li>Let’s move on to build the template structure that will extract the data from the xml file. </li></ul></ul><ul><ul><li>Create a Container element, that has a Paragraph and two Containers in it. </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  40. 40. Document template <ul><li>Content design </li></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>Drag the Object Heading attribute to the Paragraph content. </li></ul></ul>
  41. 41. Document template <ul><li>Content design </li></ul><ul><ul><li>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 : </li></ul></ul><ul><ul><li>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 </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  42. 42. Document template <ul><li>Content design </li></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  43. 43. Document template <ul><li>Content design </li></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>Create now two styles, one for the Image element, and one for the 2 nd Text element. </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  44. 44. Document template <ul><li>Content design </li></ul><ul><ul><li>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 . </li></ul></ul><ul><ul><li>After creating those styles, assign StyleIcon for the Image, and StyleSpecificTask for the Text with the Object Text attribute assigned : </li></ul></ul><ul><ul><li>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 : </li></ul></ul>
  45. 45. Document template <ul><li>Content design </li></ul><ul><ul><li>The same filtering criteria must be set over the text content that will be extracted from tables within xml source. </li></ul></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>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 : </li></ul></ul>
  46. 46. Document template <ul><li>Content design </li></ul><ul><ul><li>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. </li></ul></ul>
  47. 47. Document template <ul><li>Content design </li></ul><ul><ul><li>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 : </li></ul></ul>
  48. 48. Document template <ul><li>Content design </li></ul><ul><ul><li>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). </li></ul></ul>
  49. 49. Document template <ul><li>Content design </li></ul><ul><ul><li>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 . </li></ul></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  50. 50. Document template <ul><li>Content design </li></ul><ul><ul><li>There is the need for a script based assignment for the styles created earlier, StyleRowRepeat and StyleHeaderRow . </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  51. 51. Document template <ul><li>Content design </li></ul><ul><ul><li>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. </li></ul></ul>
  52. 52. Document template <ul><li>Content design </li></ul><ul><ul><li>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). </li></ul></ul>
  53. 53. Publishing <ul><li>Configuring dsx file </li></ul><ul><ul><li>Run your template by using the Preview or Run option, to make sure that the template design was correct : </li></ul></ul><ul><ul><li>If the RPE Launcher is missing from the RPE environment, open its perspective. </li></ul></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>If your tab does not look like the one displayed above, select File/New/Document Specification , and a new dsx file will be created. </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  54. 54. Publishing <ul><li>Configuring dsx file </li></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  55. 55. Publishing <ul><li>Configuring dsx file </li></ul><ul><ul><li>With the RPE Launcher window active, press Ctrl+S, in order to save the document specification file, and save it to the desired location. </li></ul></ul><ul><ul><li>Hit the Preview or the Run button to generate output documents; a dialog pops-up showing you that the publishing process runs. </li></ul></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  56. 56. Publishing <ul><li>Run report </li></ul><ul><ul><li>Open the output files : </li></ul></ul>
  57. 57. Publishing <ul><li>Pre-evaluating the outputs </li></ul><ul><ul><li>Taking a brief look at each output, you will note the following : </li></ul></ul><ul><ul><li>In the Word output : </li></ul></ul><ul><ul><ul><li>Headings are not numbered </li></ul></ul></ul><ul><ul><ul><li>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 </li></ul></ul></ul><ul><ul><ul><li>Table of contents items could have a custom Style with similar colors as the ones used in the template </li></ul></ul></ul><ul><ul><ul><li>Table of contents contains the Title styled words also </li></ul></ul></ul>
  58. 58. Publishing <ul><li>Pre-evaluating the outputs </li></ul><ul><ul><li>In the Html output : </li></ul></ul><ul><ul><ul><li>The title could be enhanced with a CSS style applied </li></ul></ul></ul><ul><ul><ul><li>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. </li></ul></ul></ul>
  59. 59. Publishing <ul><li>Pre-evaluating the outputs </li></ul><ul><ul><li>In the XslFo output : </li></ul></ul><ul><ul><ul><li>As in the Word output, the main content is in the same page as the table of contents items </li></ul></ul></ul><ul><ul><li>In the Pdf output, as you can see in your output.pdf result, there are no special situations that require modifications. </li></ul></ul>
  60. 60. Publishing <ul><li>Adjustments and corrections </li></ul><ul><ul><li>Go back to the RPE template and make the following modifications : </li></ul></ul><ul><ul><li>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. </li></ul></ul><ul><ul><li>Edit the code for the Table of Contents element to o &quot;2-9&quot; h z &quot;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 : </li></ul></ul>
  61. 61. Publishing <ul><li>Adjustments and corrections </li></ul><ul><ul><li>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. </li></ul></ul>
  62. 62. Publishing <ul><li>Adjustments and corrections </li></ul><ul><ul><li>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 : </li></ul></ul><ul><ul><ul><li>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 </li></ul></ul></ul><ul><ul><ul><li>the class “table” for the table element will be applied on all tables within output, tables that will have now a smaller sized text </li></ul></ul></ul><ul><ul><ul><li>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”. </li></ul></ul></ul>
  63. 63. Publishing <ul><li>Adjustments and corrections </li></ul><ul><ul><li>Create a new Style, and call it StyleCellAlternate . Put the Cell element in the Style definition, and set the cell background color to CFEEFF . </li></ul></ul><ul><ul><li>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. </li></ul></ul>
  64. 64. Publishing <ul><li>Viewing the outputs </li></ul><ul><ul><li>Run the template again : all required modifications should be now visible. </li></ul></ul><ul><ul><li>Word headings are now numbered (Word output below) </li></ul></ul><ul><ul><li>Table of contents is not on the same page with the main content (Word output below) </li></ul></ul><ul><ul><li>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) </li></ul></ul>
  65. 65. Publishing <ul><li>Viewing the outputs </li></ul><ul><ul><li>The text with Title Style looks better now in Html, as it has applied the properties from the CSS “Title” class. (Html output below) </li></ul></ul><ul><ul><li>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) </li></ul></ul>
  66. 66. Publishing <ul><li>Viewing the outputs </li></ul><ul><ul><li>In XslFo, Word, Pdf, the content is not on the same page with the Table of Contents element (XslFo output below) </li></ul></ul>
  67. 67. Publishing <ul><li>Viewing the outputs </li></ul><ul><ul><li>Check for the extracted data. </li></ul></ul><ul><ul><li>Note that the paragraphs that contain the comfort word (review slide 36 to remember the filtering conditions), are highlighted in red. </li></ul></ul><ul><ul><li>If you change the varUser value, you’ll get phrases for the safe tag highlighted. </li></ul></ul>
  68. 68. Conclusion <ul><ul><li>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. </li></ul></ul><ul><li>Styles are used in RPE to enhance speed and usability </li></ul><ul><li>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. </li></ul><ul><li>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. </li></ul>
  69. 69. References <ul><li>RPE help reference </li></ul><ul><li>Field codes : http:// office.microsoft.com/en-us/word-help/field-codes-in-word-HA010100426.aspx </li></ul><ul><li>Styles in Word : http://office.microsoft.com/en-us/word-help/style-basics-in-word-HA010230882.aspx </li></ul><ul><li>CSS basics : http://www.w3schools.com/css/default.asp </li></ul><ul><li>Color codes : http://html-color-codes.info </li></ul><ul><li>Javascript : http://www.javascriptkit.com/javatutors/ ; http://www.learn-javascript-tutorial.com/ </li></ul>
  70. 70. More information <ul><li>More tutorials and video lessons : www.reportingarena.com </li></ul><ul><li>Questions, observations, feedback : [email_address] </li></ul>