RTF: The RTF class

Description Usage Arguments Fields and Methods Author(s) See Also Examples

Description

This is the class representing an RTF file output.

Package: rtf
Class RTF

Object
~~|
~~+--RTF

Directly known subclasses:

public static class RTF
extends Object

Usage

1
RTF(file="", width=8.5, height=11, omi=c(1, 1, 1, 1), font.size=10)

Arguments

file

The path of the output file.

width

The width of the output page.

height

The width of the output page.

omi

A vector representing the outer margins in inches (bottom, left, top, right).

font.size

Default font size for the document in points.

Fields and Methods

Methods:

addHeader Insert a header into the RTF document.
addNewLine Insert a new line into the RTF document.
addPageBreak Insert a page break into the RTF document optionally specifying new page settings.
addParagraph Insert a paragraph into the RTF document.
addPlot Insert a plot into the RTF document.
addPng Insert an existing PNG image into the RTF document.
addSessionInfo Insert session information into the RTF document.
addTOC Insert table of contents field.
addTable Insert a table into the RTF document.
addText Insert text into the RTF document.
addTrellisObject Insert a trellis plot object into the RTF document.
decreaseIndent Decrease RTF document indent.
done Write and close the RTF output.
endParagraph End a paragraph in the RTF document.
increaseIndent Increase RTF document indent.
setFontSize Set RTF document font size.
startParagraph Start a new paragraph in the RTF document.
view View encoded RTF.

Methods inherited from Object:
$, $<-, [[, [[<-, as.character, attach, attachLocally, clearCache, clearLookupCache, clone, detach, equals, extend, finalize, getEnvironment, getFieldModifier, getFieldModifiers, getFields, getInstantiationTime, getStaticInstance, hasField, hashCode, ll, load, names, objectSize, print, save

Author(s)

Michael E. Schaffer

See Also

For more information see RTF.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 ## Not run: 
 output<-"test_RTF-class.doc"
 png.res<-300

 rtf<-RTF(output,width=8.5,height=11,font.size=10,omi=c(1,1,1,1))
 addHeader(rtf,title="Test",subtitle="2011-08-15\n")
 addPlot(rtf,plot.fun=plot,width=6,height=6,res=300, iris[,1],iris[,2])

 # Try trellis plots
 if(require(lattice) & require(grid)) {
 	# single page trellis objects
 	addPageBreak(rtf, width=11,height=8.5,omi=c(0.5,0.5,0.5,0.5))

 	p <- histogram( ~ height | voice.part, data = singer, xlab="Height")
 	addTrellisObject(rtf,trellis.object=p,width=10,height=7.5,res=png.res)

 	p <- densityplot( ~ height | voice.part, data = singer, xlab = "Height")
 	addTrellisObject(rtf,trellis.object=p,width=10,height=7.5,res=png.res)

 	# multipage trellis object
 	p2<-xyplot(uptake ~ conc | Plant, CO2, layout = c(2,2))
 	addTrellisObject(rtf,trellis.object=p2,width=6,height=6,res=png.res)
 }

 addPageBreak(rtf, width=6,height=10,omi=c(0.5,0.5,0.5,0.5))
 addTable(rtf,as.data.frame(head(iris)),font.size=10,row.names=FALSE,NA.string="-")

 addSessionInfo(rtf)

 done(rtf)
 
## End(Not run)
 

rtf documentation built on March 26, 2020, 7:40 p.m.