After seeing Tim Dixter post about fixed line and row filler I decided to post about the handling string wrapping in the template.
Here is the invoice template screens hot,
Ok let me start explaining how I handle the string wrapping. Before that let me let me tell you the requirement.
1. Need to display fixed lines.
2. If there is only few lines and the page is not filled then we need to print blank lines to fill the page.
3. At the end of the report we need to display the summary as shown above.
4. At the end of the rows including the rows with values and blank rows we need to print a line to end the box.
To handle the string wrapping I had taken the number of characters that will fit into item description field (this is expected to wrap), in my example 24 characters will fit in a single line. So I took length(item_description) mod 24 which will give me no. of rows that item description will take. This I do it for all invoice rows.
And again as per my example 36 lines will fit into one page (including the summary).
Now let me give you the pseudocode of my logic.
START
Loop
1. Print the invoice row.
2. Keep the count of number of lines each invoice row is taking. ex: v_rowcount = v_rowcount + length(ITEM_DESCRIPTION) MOD 24 (this is the text wrapping handler)
IF v_rowcount >= 36 THEN
i) Prinit the line to close the box.
ii) Reset v_rowcount to zero.
END IF;
END LOOP
3. Take the balance rows available to print empty lines (ex v_balance_line = v_rowcount – 36)
4. Now I will have to cases. First is there may not be sufficient lines available to print the summary. In this case we need to display empty lines and then print at the end of next page. So,
IF v_balance_lines < 7 (this the number of lines required to print summary) THEN
i) Print blank lines for remaining lines to find the number of blank rows to be printed use the variable v_rowcount. so here the no of blank lines will be 36 – (v_rowcount)
ii) Print the line to close the box.
iii) enable a flag to say we need to print empty rows in the 29 empty rows in the next page. So that the summary comes at the end.
ELSE IF v_balance_lines > 7 THEN
i) print blank lines by making sure you leave 7 lines to print summary. to find the number of blank rows to be printed use the variable v_rowcount. so here the no of blank lines will be 36 – (v_rowcount+ 7)
ii) Print the line to close the box.
iii) Print the summary
END IF;
5. Check whether the flag is enables to print 29 blank lines. If yes,
i) Print 29 blank lines.
ii) Print the line to close the box.
iii) Print the summary
END
Thats all. If you closely watch the above pseudocode you will get the logic of handling text wrapping.
I know as usual I had not formatted this post well
But for your convenience I had attached the sample rtf file also. If you need the exact RTF then do leave your comment and I will try to attach that also here.
Attached Files:
About the Author | |
|
AK Lakshmanan
Lakshmanan Ashok Kumar is an oracle EBS technical enthusiastic. He has hands full of experience on Oracle forms, reports, and BI Desktop Publisher. Otherwise Lakshmanan Ashok Kumar is also a Techno Functional person in Order 2 Cash and Manufacturing modules. We are glad to have Lakshmanan's thoughts and views of various oracle EBS stand and hope you enjoy his posts. |
Tags: BI Publisher, fixed line, Invoice print, text wrapping