XML Publisher template design skills

Source: Internet
Author: User
Tags manual writing xsl blank page

2. rtf Template Development

2.1. Overview of this Chapter
2.1.1. Content of interest
I believe that with the continuous upgrade of the xmlp version, the visualization function on the desktop side will greatly simplify our design work, but there are still some places that cannot be completed without manual Writing of commands; in addition, although template development relies on the word function, some "little-known" word functions require additional prompts.
Therefore, this chapter describes how to solve common problems. It does not include the complete user guide function, and does not include the help of word.
2.1.2. xmlp and XSL-FO
You can write layout languages in two ways: XSL statements and xmlp simple statements. We recommend that you use the former because it is an international standard. In addition, these two syntaxes can be used together, such as the preceding condition to format rows and cells.
In RTF, only simple xmlp statements can be written. In the form field, both of the preceding statements can be used.
The form field is not allowed in the standard header and footer, but can be used in the Expanded header and footer.
Xmlp provides the syntax, are a simplified "code", the actual need to translate into XSL, if you are proficient in XSL-FO, then you can also directly use this syntax in the form field, free and flexible! The following SQL shows the converted XSL-FO:
Select t2.application _ short_name,
T2.template _ code,
T1.language,
T1.template _ name,
T3.file _ name,
T3.xdo _ file_type,
T3.file _ DATA
From xdo. xdo_templates_tl T1, xdo. xdo_templates_ B T2, xdo. xdo_lobs T3
Where t1.template _ code = t2.template _ code
And t2.template _ code = t3.lob _ code
And t1.language = 'us'
And t1.template _ code = 'cuxxmlpdemo'
TIPS: C:/program files/Oracle/XML Publisher desktop/samples/RTF templates has good examples for your reference.

2.2. layout formatting
2.2.1. Recommended Practices
Take full advantage of the word Formatting Function: custom paper, color, font size, font size, title style, background, watermark, alignment, table, column, template date, number/Date Format of form field, file image, header/footer, automatic Collection.
Although code control is possible, since we rely on word as a visual design tool, we should try to use the word function to design reports!

2.2.2. Word Table
Like web pages, tables play a vital role in report layout and must be mastered, especially:
1. Duplicate title lines allow you to duplicate titles on a new page.
2. nested tables, row and column merging, borders, and shading can achieve special layout.
3. Fixed column width, automatic adjustment, and cross-page disconnection prohibited, which can implement some strict layout control.
2.2.3. Line truncation and disallow
In document printing, the format requirements are relatively high. If a row is too long or has been folded multiple times, the layout will be damaged, especially for scenarios with high requirements such as nesting, various methods are summarized here.
1. Word functions, not ideal
The fixed column width function can be used, but the fixed row height does not work. Although the "fixed" function is displayed during the design, if no control is added, data with multiple column widths will be automatically folded after the operation.
2. Single Row + truncation, that is, the control is only in line, excessive truncation, prohibit line
After the field, add two more commands:
<XSL: attribute xdofo: CTX = "Block" name = "Wrap-option"> NO-wrap </XSL: attribute>
<XSL: attribute xdofo: CTX = "Block" name = "overflow"> hidden </XSL: attribute>
3. multi-row + truncation, difficult
For example, if three rows are fixed and the remaining part is truncated, it cannot be implemented through the template currently. Only the number of characters in the data source that has exceeded just three rows is used, and then the automatic LINE folding function is used. Note the space here. If a space is displayed, the subsequent words will be automatically folded in advance.

2.2.4. Conditional Formatting
Different colors, different columns, different titles, and different layout styles are displayed under different conditions. The if command is required.
1. For example, the printing formats of different currency creden are different.
<? If: currency_code = "CNY"?> Any layout <? End if?>
<? If: currency_code! = "CNY"?> Any layout <? End if?>
2. For example, if the currency is CNY, the column is displayed. Write the following statement in the cell of the target column:
<? If @ column: currency_code = "CNY"?> Field Value and format <? End if?>
Note: This is not a real dynamic column.
3. For example, if the base color of an even row is gray, write the following statement in any cell of the row:
<? If @ row: Position () mod 2 = 0?>
<XSL: attribute xdofo: CTX = "incontext" name = "background-color"> gray </XSL: attribute>
<? End if?>
4. For example, if more than 100 cells are in red, write the following statement in the target cell:
<? If: quantity> 100?>
<XSL: attribute xdofo: CTX = "Block" name = "background-color"> Red </XSL: attribute>
<? End if?>

2.3. Field Calculation skills
2.3.1. Recommended Practices
1. calculated fields can be completed first in SQL.
2. If Oracle Reports is used as the data source, the calculated and statistical fields can also be completed first.
3. Data in SQL is not formatted and the format is set in the template. fields that need to be calculated in the template must not be formatted. It mainly means that numbers cannot contain symbols.

2.3.2. Group total
N: Template Builder/insert/Field
The wizard can complete basic statistics. Currently, sum, Count, Min, Max, and avarage in the group are supported.
Sample Code automatically generated: <? Sum (Quantity)?>.
2.3.3. Total in the page
To achieve the total count on this page, you need to declare the total variable and display the total variable (the format can be included) in two steps ).
1. Aggregate the quantity data on this page and declare the variable qtytotal. Be sure to write the data in the corresponding quantity group. Otherwise, the data cannot be referenced.
<? Add-page-total: qtytotal; 'quantity '?>
2. Show the total count in any place
<? Show-page-total: qtytotal?>
So how can we aggregate data within the group + pages?
. 3.4. total carry-over
Display the total count on the previous page to the next page. Similar to "total on the page", two steps are required: declaring the total variable and displaying the total variable.
For more information, see User Guide "brought forward/carried forward totals.
2.3.5. Accumulative running totals
Accumulate the number of each row. This is actually done in this way: declare a variable first, initialize to 0, accumulate, and display the accumulate where needed.
1. initialize before group tag, set variable
<? Xdoxslt: set_variable ($ _ xdoctx, 'rtotalvar', 0)?>
2. Calculate the cumulative value, which is usually written in the same cell of the field to be accumulated, such as the following quantity
<? Xdoxslt: set_variable ($ _ xdoctx, 'rtotalvar', xdoxslt: get_variable ($ _ xdoctx, 'rtotalvar') + quantity)?>
3. display the accumulated value and get variable anywhere.
<? Xdoxslt: get_variable ($ _ xdoctx, 'rtotalvar')?>

2.4. Any page Problems
2.4.1. New Group Paging
Pagination is natural, but if you want to force pagination at a certain place, such as a new group of pages, you can use the word paging character (CTRL + enter Shortcut Key), but it will lead to the final blank page; you can only use the following methods:
1. Add @ section to the group declaration, as shown in <? For-each @ section: g_po_header?>.
2. <? End for-each?> Add before <? Split-by-page-break:?>. After this translation, it is actually:
<XSL: If test = "position () <last ()">
<XSL: attribute name = "break-before"> page </XSL: attribute>
</XSL: If>
3. <? End for-each?> Add <XSL: attribute name = "break-after"> page </XSL: attribute> to the front. In this method, there is no blank page at the end of the RTF file, but there is a blank page in the PDF file.
4. <? End for-each?> Add <XSL: attribute name = "break-before"> page </XSL: attribute>. In this method, blank pages are displayed at the end of the RTF and PDF files.

2.4.2. Conditional paging and fixed row Paging
1. Any conditional paging requires the use of the break-after or break-before above if +, such:
<? If: currency_code = "CNY"?>
<XSL: attribute name = "break-before"> page </XSL: attribute>
<? End if?>
2. Fixed row pagination. You need to use the break-after or break-before in the IF + method? End for-each?> The following statement controls five rows on each page:
<? If: Position () mod 5 = 0?>
<XSL: attribute name = "break-before"> page </XSL: attribute>
<? End if?>

2.4.3. header and footer
1. The standard header and footer, that is, a single header and footer, can be used with the word function.
2. The expanded header and footer can be used <? Start: body?> <? End body?> The body part is framed. anything other than the two marks will be treated as the header and footer.
2.4.4. Page number and page number
1. You can use the word "Automatic Collection" to insert the page number anywhere. This is a "natural page number ".
2. If you want to start the page number from a specific value in some cases, such as re-numbering the new group page number, you need to use the command, such as after for-each: <? Initial-page-number: 1?>. Here, "1" can also be replaced by XML elements in the data file.

2.4.5. The last and even pages are different.
1. Word can be used in the header and footer sections to achieve different homepage or parity pages, and different last pages cannot be implemented. Even with code control, the last page layout is actually implemented differently, different from "header and footer.
<? Start @ last-page: body?> <? End body?>
When a report has only one page, <? Start @ last-page-First: body?> <? End body?>
In the example of "Advanced/last page", note that the layout needs to be independent into pages, that is, pagination is required before.
2. end with an even page. The main purpose is to display the even page header and footer.
<? Section: force-page-count; 'end-on-even-layout '?>
If only blank pages are displayed, <? Section: force-page-count; 'end-on-even '?>
3. end with an odd page. The main purpose is to display the odd page header and footer
<? Section: force-page-count; 'end-on-odd-layout '?>
If only blank pages are displayed, <? Section: force-page-count; 'end-on-odd'?>

2.5. Use multimedia elements
2.5.1. Word Functions
You can use formulas, drawings (such as organization charts and lines), art words, and clip art.
If you want to control these objects within a limited scope by code, such as displaying text, scaling, rotating, moving, and copying, see "Drawing, shape and clip art support" in the user guide ".

2.5.2. Check box
Insert the checkbox form field. If this field is selected, it indicates true. If this field is not selected, it indicates false. You must enter a conditional expression, for example, 0.
2.5.3. drop-down list
Insert the form field in the drop-down box, define the elements in the drop-down box, and enter the XML tag to be referenced in "self-typed", as shown in <% area_index %>. Here, pay attention to the order of elements, because it is matched by the sequence number and the value of the runtime, that is, in XML data, area_index is a natural number 1, 2 .......

2.5.4. hyperlink
You can directly use the word function to set hyperlinks, or reference all or part of the tags in the XML data file in the link address to achieve dynamic hyperlinks:
{Supplier_site_url} or
[Url] http://huajhua.leiko.com: 8000/oa_media/[/url?#currency_code=.gif

2.5.5. Image
You can directly use the word function to insert an image. You can also use the image as a bitmap and use the "optional text" in the "set image format" tab of the image ", enter the real image address:
1. image from the website: URL: {'[url] http: // localhost: 8000/oa_media/forms_logo.gif' [/url]}.
2. image from EBS: URL: {'$ {oa_media}/forms_logo.gif '}.
3. dynamically specify the URL: {image_url }.
4. dynamically spliced URL: {Concat (server, '/', image_dir, '/', image_file )}.
5. XML elements directly from blob are only used for "data templates ":
<FO: instream-foreign-object Content-Type = "image/jpg">
<XSL: value-of select = "image_element"/>
</FO: instram-foreign-Object>

2.5.6. Charts
You can use the template builder Wizard to insert charts of the following types: bar chart-vertical, bar chart-horizontal, pie chart, and line chart.

The code generated by the wizard can be seen in the "optional text" in the "set image format" website Tab Of the image. We can make further modifications.

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/meteorlWJ/archive/2008/11/17/3321116.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.