36
TH Technology Karen Cannell [email protected] RTF 101: Building an RTF Document

RTF Primer: Building and RTF Document

Embed Size (px)

Citation preview

Page 1: RTF Primer:  Building and RTF Document

TH Technology

Karen Cannell

[email protected]

RTF 101: Building an RTF

Document

Page 2: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

About Me …

Karen Cannell ~ Consultant, TH Technology

Mechanical/SW Engineer - Analyzed, designed,

developed, converted, upgraded, enhanced legacy &

database applications for 25+ years

Building APEX applications for government, medical,

engineering industries since HTMLDB

Leveraging the Oracle 10g,11g,12c suite of tools

Oracle Ace Associate

Editor, Technical Journal

Send ODTUG Technical Journal Content!

Page 3: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

APEX Books …

Expert Oracle Application Express, APress

2015 Report Printing

Beginning Application Express

4.2, APress, 2013

Agile Oracle Application Express

APress, 2012

Page 4: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

About You …

Why RTF?

Experience?

Applications?

Page 5: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Session Objectives

RTF Overview

RTF Document Structure

RTF How To Build

Applications

Page 6: RTF Primer:  Building and RTF Document

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

Page 7: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Why RTF?

Well Known Format

Plain Text ~ Readily Readable

Sane Formatting

Easy To Generate

Page 8: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Why RTF? (Developer Perspective)

Simplicity

Plain Text

Sane Coding

Easy To Learn

Page 9: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Why? (Me)

Had to Build a Word Document

Unknown # of Pages

Known Format

RTF WAY Easier to Learn and Build

Page 10: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Uses

Document Generation

Report Templates

Merge/Substitutions

Page 11: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Example – Swipe Card

Page 12: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Looks Like .. In Plain Text Editor

Page 13: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

RTF Example

End / “Footer”

Page 14: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Note: Plain Text Editor

WordPad

Notepad

EditPad Lite

SQL Developer

MS Word Adds Bloat!

Page 15: RTF Primer:  Building and RTF Document

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

Page 16: RTF Primer:  Building and RTF Document

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.

Page 17: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Structure of an RTF File

The Basics

{ <header> <document> }

Page 18: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

RTF Example

Header

Page 19: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

RTF Header

{\rtf1\ansi\ansicpg1252

{ … } Open/Close Object

\rtf1 RTF Version 1

\ansi ANSI Character Set (Default)

\ansicpg1252 US Windows Code Page

Page 20: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Header .. Page Size

\paperw4860 \paperh3060 \margt144

\margb144 \margr144 \margl144

\paperwN

\paperhN

\margtN

\margbN

\margrN

\marglN

Page 21: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Twips

“Sizes” in Twips For Most Control Words

Twips == 1440/inch, 20/pt

Inch * 1440 == Twips

Page 22: RTF Primer:  Building and RTF Document

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

Page 23: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Header … Fonts and Styles

\deff0{\fonttbl{\f0\fnil\fcharset0 Calibri;}{\f1\fnil

Times New Roman;}{\f2\fnil\fcharset0 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

Page 24: RTF Primer:  Building and RTF Document

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

Page 25: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Tables

No Table Group

Paragraphs Properties

“Table” == Series of Table Rows

\trowd … \row

“Row” == Series of Paragraphs

\trowd … \row

Page 26: RTF Primer:  Building and RTF Document

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

Page 27: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Graphics

Embedded

Easiest

Paste in WordPad, Save.

Edit Around As Needed

Referenced/External

Page 28: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Footer

}

Ends the RTF Document

{ … } Groups Must Be Matched

Page 29: RTF Primer:  Building and RTF Document

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!

Page 30: RTF Primer:  Building and RTF Document

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

Page 31: RTF Primer:  Building and RTF Document

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?)

Page 32: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Good Luck!

Page 34: RTF Primer:  Building and RTF Document

TH Technology

RTF 101

Share Your Knowledge!

ODTUG Technical Journal

Call for Articles/Reviewers

Editor, ODTUG Technical Journal

[email protected]

Page 35: RTF Primer:  Building and RTF Document

TH Technology

Questions ?

RTF Primer [email protected]

http://thtechnology.com

Page 36: RTF Primer:  Building and RTF Document

TH Technology

Thank You

RTF Primer [email protected]

http://thtechnology.com