RTF is a simple, universal document exchange format. So simple it is often overlooked as a viable option for document or report generation. Learn the basics of RTF here.
6. TH Technology
RTF 101
Rich Text Format
“…format for text and graphics interchange …
different output devices, operating
environments and operating systems.”
Microsoft Standard
MS Word
7. TH Technology
RTF 101
Why RTF?
Well Known Format
Plain Text ~ Readily Readable
Sane Formatting
Easy To Generate
8. TH Technology
RTF 101
Why RTF? (Developer Perspective)
Simplicity
Plain Text
Sane Coding
Easy To Learn
9. TH Technology
RTF 101
Why? (Me)
Had to Build a Word Document
Unknown # of Pages
Known Format
RTF WAY Easier to Learn and Build
14. TH Technology
RTF 101
Note: Plain Text Editor
WordPad
Notepad
EditPad Lite
SQL Developer
MS Word Adds Bloat!
15. TH Technology
RTF 101
MS Word Adds Bloat!
47K to 104K
Demo MS Word Bloat
All That Extra Formatting Not Necessary
Makes Coding / Reading / Using Harder
16. TH Technology
RTF 101
Create a Clean RTF
Open in MS Word (or Other Editor)
Copy Contents ( CTRL-A, CTRL-C)
Paste into Blank WordPad Document
Save From WordPad.
22. TH Technology
RTF 101
Header .. Page Size, Margins
paperw4860 paperh3060 margt144
margb144 margr144 margl144
4860/1440 = 3.375 in
3060/1440 = 2.125 in
0.1 in margins all around
23. TH Technology
RTF 101
Header … Fonts and Styles
deff0{fonttbl{f0fnilfcharset0 Calibri;}{f1fnil
Times New Roman;}{f2fnilfcharset0 Mag
Track 1 XPS Card Printer;}}
Default Font is F0
F0 is Calibri
F1 s Times New Roman
F2 is Mag Track 1 XPS Card Printer
Styles
24. TH Technology
RTF 101
Basic Paragraph
pard … par
pard resets formatting
fsNN Font Size in Half Points
fs20 Font Size 10pt
par ends the pard
25. TH Technology
RTF 101
Tables
No Table Group
Paragraphs Properties
“Table” == Series of Table Rows
trowd … row
“Row” == Series of Paragraphs
trowd … row
26. TH Technology
RTF 101
Tables … More
trgaphN Half Space Between Rows in Twips
trgap0 == No Gap Between Rows
clvertalc Text Centered Vertically Betw Rows
cellx1648 Cell Width in Twips
1648/1440 == 1.1
cellx4602 Cell Width in Twips
4602/1440 == 3.2
29. TH Technology
RTF 101
Generating via PL/SQL
One Card First-Only Template
> 1 Card First Template ( No Footer)
Body Template (No Header)
Concatentate In a Loop …
Simple Concatenate: ||
Can’t Do That w MS Word!
30. TH Technology
RTF 101
Building an RTF (PL/SQL)
PL/SQL to
Open First Template
Loop
Replace
Concatenate Body Template
End
Add Footer
Save As
31. TH Technology
RTF 101
Alexandria Utilities
FILE_UTIL_PKG.GET_CLOB_FROM_FILE ()
Load RTF Template Into CLOB
STRING_UTIL_PKG.MULTI_REPLACE (…)
Do Substitutions
FILE_UTIL_PKG.SAVE_CLOB_TO_FILE (…)
Save To File
SQL_UTIL_PKG.CLOB_TO_BLOB (…)
IF need a BLOB (DB Storage?)