13 Create RTF Templates

This topic describes the concepts of associating XML data to layout elements in an RTF report template. It describes basic and advanced techniques for creating complex and highly conditionalized report formats.

Create a Data Set Using a View Object

Publisher enables you to connect to your custom applications built with Oracle Application Development Framework and use view objects in your applications as data sources for reports.

Performance of the query execution is better as the SQL is executed directly against the database.

Before you can create an Publisher data model using a view object, you must first create the view object in your application.

  1. Click the New Data Set toolbar button and select View Object.
  2. In the New Data Set - View Object dialog, enter a name for this data set.
  3. Select the Data Source from the list. The data sources that you defined in the providers.xml file display.
  4. Do one of the following:
    • Select Yes for Execute as SQL to extract the SQL query form the View Object and execute it on the Oracle Analytics Server domain.
    • Select No to execute the view object on the Oracle Applications domain through the ADF layer. The XML data is then streamed to the Oracle Analytics Server domain in chunks. This method results in poorer performance, but enables execution on the Applications domain. You can invoke some service interface layers to allow custom data manipulation.
  5. Enter the fully qualified name of the application module, for example, example.apps.pa.entity.applicationModule.AppModuleAM.
  6. Click Load View Objects.

    Publisher calls the application module to load the view object list.

  7. Select the View Object.

    Any bind variables defined are retrieved.

  8. Create a parameter to map to this bind variable.
  9. Click OK to save your data set.

Use Barcode Fonts in Reports

Publisher includes several fonts that output barcodes.

Font files included with Publisher:

  • LibreBarcode128-Regular.TTF - Supports code128a, code128b, and code128c algorithms. Also supports code128auto to automatically switch between the three code128 algorithms.
  • LibreBarcode39-Regular.TTF - Supports code39 and code39mod43 algorithms.
  • LibreBarcodeEAN13Text-Regular.TTF - Supports upca and upce algorithms.

When you use one of these prepackaged fonts, Publisher executes the preprocessing on the data prior to applying the barcode font to the data in the output document. For example, to calculate checksum values or start and end bits for the data before formatting them.

At design time, you don't need to apply the barcode font to the field in Microsoft Word. Instead, you can map the font that you apply to the field using Publisher's font mapping. At runtime, Publisher applies the barcode font to any field using the base font you specified in the font mapping. Be sure to choose a font that isn't used elsewhere in the template.

If you want to use the font directly in Microsoft Word, then add the appropriate .TTF file to the C:\WINDOWS\Fonts directory. To use the Template Builder Preview function, map the font in the Template Builder configuration file.

To use the barcode fonts in the report output:

  1. Insert a field in the template where the barcode is to display in the report output.
  2. In the form field, enter the following command:
    <?format-barcode:data;'barcode_type'?>
    

    where

    data is the element from the XML data source to be encoded. For example: INVOICE_NO

    barcode_type is one of the supported algorithms listed above.

    Examples:

    <?format-barcode:INVOICE_NO;'code128a'?>
    
    <?format-barcode:INVOICE_NO;'code39mod43'?>
    
    <?format-barcode:INVOICE_NO;'upca'?> 
    
  3. In Microsoft Word, apply the font to the field. If you haven't installed the barcode fonts on your client machine, then select a font that isn't used elsewhere in the template, for example, Bookman.
  4. Configure the font in the Font Mapping page. For more information about the Font Mapping page.

Note the following:

  • Microsoft Word may not render the barcode fonts properly even when they're installed on your client. To work around this issue, apply a different font to the field and map the font as described above.

  • The upca algorithm accepts only UPC-A message string and encodes into UPC-A barcode.

  • A string of 12 characters is treated as UPC-A message with a check digit, 11 is without a check digit.

  • The upce algorithm accepts only UPC-E message strings and encodes into UPC-E barcode.

  • A string of 8 characters is treated as a UPC-E message with both a front and end guard bar; a string of 6 characters is without guard bars.

Implement Custom Barcode Formats

If you choose to use a custom barcode instead, use this procedure to implement a custom barcode.

Publisher offers the ability to execute preprocessing on the data prior to applying a barcode font to the data in the output document. For example, you might need to calculate checksum values or start and end bits for the data before formatting them.

The solution requires that you register a barcode encoding class with Publisher that can then be instantiated at runtime to apply the formatting in the template.

To enable the formatting feature in the template, you must use two commands in the template. The first command registers the barcode encoding class with Publisher. This must be declared somewhere in the template prior to the encoding command. The second is the encoding command to identify the data to be formatted.

Register the Barcode Encoding Class

You can include barcodes in form fields.

Use the following syntax in a form field in the template to register the barcode encoding class:

<?register-barcode-vendor:java_class_name;barcode_vendor_id?>

This command requires a Java class name (this carries out the encoding) and a barcode vendor ID as defined by the class. This command must be placed in the template before the commands to encode the data in the template. For example:

<?register-barcode-vendor:'oracle.xdo.template.rtf.util.barcoder.BarcodeUtil';'XMLPBarVendor'?>

where

oracle.xdo.template.rtf.util.barcoder.BarcodeUtil is the Java class and

XMLPBarVendor is the vendor ID that is defined by the class.

Encode the Data

Use this syntax in a form field in the template to format the data.

<?format-barcode:data;'barcode_type'?>

where

data is the element from the XML data source to be encoded. For example: LABEL_ID

barcode_type is the method in the encoding Java class used to format the data. For example: code128a.

For example:

<?format-barcode:LABEL_ID;'code128a'?>

At runtime, the barcode_type method is called to format the data value and the barcode font is then applied to the data in the final output.

2D Barcode Functions

You can use the QR code or PDF417 2D barcode type in RTF templates. When you create an RTF template, use the qrcode or pdf417 functions to specify the barcode type. These functions don't require external fonts.

qrcode Syntax

<?qrcode: <DATA>; <SIZE>[; <CHARSET>[; <ECLEVEL>[; <GS1FORMAT>[; <MASKPATTERN>[; <QRVERSION>]]]]]?>

where

  • DATA – Data to be encoded in the QR code format.
  • SIZE – QR code size dimension in points(pt).
  • CHARSET – (Optional) Character set for encoding the data. Default is UTF8.
  • ECLEVEL – (Optional) QR code error correction level. Default is "M".

    Valid values are:

    • "H" (~30% correction)
    • "Q" (~25% correction)
    • "M" (~15% correction)
    • "L" (~7% correction)
  • GS1FORMAT – (Optional) Whether to encode data in GS1 format. Enter "true" to encode data using the GS1 standard.
  • MASKPATTERN – (Optional) QR code mask pattern to be used. Default is optimal mask pattern. Valid values are integers (or string representation of integers) from 1 to 7.
  • QRVERSION – (Optional) Exact version of the QR code to be encoded. Default is the version determined by the size of data to be encoded. Valid values are integers (or string representations of integers) from 1 to 40.
For example, the qrcode syntax to generate QR code with data of size 200pixel, high error correction level, GS1 format encoding, QR code version 4, and to use the default values of character set and mask patterns:
<?qrcode: ‘01049123451234591597033130128’; ‘200’;’’ ; ‘H’; ‘true’; ‘’; 4?>

Note the character set and mask patterns are left blank to use the default values.

pdf417 Syntax

<?pdf417: <DATA>[; <XSCALE>[; <COLUMNS>[; <ROWS>[; <CHARSET>]]]]?>

where

  • DATA – Data to be encoded in the PDF417 format.
  • XSCALE – Point(pt) per PDF417 module width. Default is 1 (1pt per module).
  • COLUMNS – The number of columns to be used in the generated PDF417 symbol. Default is -1.
  • ROWS – The number of rows to be used in the generated PDF417 symbol. Default is -1.
  • CHARSET – (Optional) Character set to be used to encode data with the Byte compaction mode. Specify CHARSET only if the data contains non-Latin-1(ISO-8859-1) characters.