Home Page FO Designer user guide. XSL-FO tool for Oracle APEX and the Java[TM] platform
Home
                                                    FO Designer guide
                                                  • First steps
                                                  • Introduction
                                                  • The user interface
                                                  • Working with the interface
                                                  • Structure of the template
                                                  • Executing the template to create PDF files
                                                  • Learn by doing
                                                  • The invoice IDOC example
                                                  • The Group by example
                                                  • The two columns example
                                                  • Barcodes
                                                  • Charts
                                                  • The running totals example
                                                  • Interactive forms
                                                  • Flavours
                                                  • The base template
                                                  • Long texts and HTML fields
                                                  • The memo field explained
                                                  • Advanced functionalities
                                                  • FOP Could Server
                                                  • Migration of existing XSL-FO files
                                                  • FAQS
                                                  • Troubleshooting
                                                  • Licenses
                                                  • Learn by doing
                                                    bcl_716964462.htm

                                                    6. Learn by doing: tutorial

                                                    Loading the examples from the file system

                                                    Too small? watch it in Youtube here.

                                                    The examples in the database


                                                    Use the open database icon to open the database. Use the default user admin and password admin.

                                                    Use the open report from database icon to access the examples. Please note you will find more examples to be imported in the installation examples/projects  directory.


                                                    Hands on example

                                                    In this tutorial we will take as input an XML document which contains the list of employees for each department. We want to create a PDF file with the list of departments and for each department the list of employees.

                                                    We will start running the FO Designer and we get an empty template.

                                                    1. First we load the XSD file departmentEmployees.xsd. The result will be.



                                                      as an alternative (if we do not have a XSD file), we can click on the create schema from XML button and load the XML document departmentEmployees.xml. This would read the XML document and list of existing XML nodes, as a result it would create a kind of "virtual" schema.
                                                    2. As second step we copy and paste the XML test file in the XML test files folder departmentEmployees.xml. As you can see this file contains 2 departments:

                                                    3. Our template will use 2 areas, the header area for the name of the department and the




                                                      detail area for the employees. So first we will tell FO Designer we want to have a header area for each department in the XML document. So we click on the header area title button to display the properties of the area and we set /departments/department.



                                                      furthermore we set the New page property (in the control tab) to true because we want to have a new page for each department.
                                                    4. Now we do something similar with the detail area, we click on the detail are title button and set the XML Node to /departments/department/person, since we want to have a detail line for each employee, furthermore, you have to make sure the XML Node type is relative since we want to list only the employees of the current department.



                                                      Note also we have set visibility flag in the detail header area to false because we will not use that area.

                                                    5. We will now add some fields to the header area. Click on the button and place the following fields in the header area:



                                                      the only properties you must change are:

                                                      value = List of employees
                                                      font = size 18
                                                      font color=red
                                                    6. next you add 2 more fields, the properties you have to set are:

                                                      value
                                                      property of the left field = Department:
                                                      value property of the right field = empty
                                                      name property of the right field = DepartmentName
                                                      XPath property of the right field = /departments/department/departmentName
                                                    7. Now we can test the template by clicking on the PDF button The output will be a PDF file with two pages:



                                                    8. As next step you can proceed adding the fields in the detail area:



                                                      the three fields on the left have a black border because we have defined the constant property to true. For all these 3 fields you have to:
                                                      1. drag the field tool
                                                      2. to the place in the area
                                                      3. change the constant property to true and the value property to the value you see in the screenshot (Name:, Address: and Status:)
                                                      4. Add 2 variable fields (the ones with blue borders) and select as Xpath /departments/department/person/name and /departments/department/person/address
                                                      5. the third variable field is actually a combo box and must be defined like this:
                                                      6. Drag the combo box tool to the area
                                                      7. Set the XPath to /departments/department/person/status
                                                      8. The Keys list must be defined as in this screenshot:



                                                        in this way the values A and I which are contained in the XML document will be replaced with the more descriptive values "Active" and "Inactive".
                                                    9.  We can test the template by clicking on the PDF button
                                                    10. The output will now contain the detail information (persons):



                                                    11. we can also add a line to separate the persons, note we added in this screenshot a line object:

                                                    12. The output is now:



                                                    13. And last we will add a counter field in the template footer. This field has the following special handling:
                                                      • We have used the count() function in the Xpath to counter the number of persons in the department.
                                                      • We use the XPath type absolute which means the Xpath will be issued exactly as we enter it.
                                                      • The XPath itself references only the person node. The reason for this is, the footer is implicitly dependent on the header and the header is associated to the department node.

                                                        It would also be correct to set the relative and the XPath to count(/departments/department/person). However the use of functions and the xpath type relative is in this version of the designer not supported.