Learn R Programming

DescTools (version 0.99.52)

WrdTableBorders: Draw Borders to a Word Table

Description

Drawing borders in a Word table is quite tedious. This function allows to select any range and draw border lines around it.

Usage

WrdTableBorders(wtab, from = NULL, to = NULL, border = NULL,
                lty = wdConst$wdLineStyleSingle, col = wdConst$wdColorBlack,
                lwd = wdConst$wdLineWidth050pt)

Value

nothing

Arguments

wtab

a pointer to a Word table as returned by WrdTable or TOne.

from

integer, a vector with two elements specifying the left upper bound of the cellrange.

to

integer, a vector with two elements specifying the right bottom of the cellrange.

border

a Word constant (wdConst$wdBorder...) defining the side of the border.

lty

a Word constant (wdConst$wdLineStyle...) defining the line type.

col

a Word constant (wdConst$wdColor...) defining the color of the border. See examples for converting R colors to Word colors.

lwd

a Word constant (wdConst$wdLineWidth...pt) defining the line width.

Author

Andri Signorell <andri@signorell.net>

See Also

WrdTable

Examples

Run this code
if (FALSE) {

# create table
tab <- table(op=d.pizza$operator, area=d.pizza$area)

# send it to Word
wrd <- GetNewWrd()
wtab <- ToWrd(tab, wrd=wrd, tablestyle = NA)

# draw borders
WrdTableBorders(wtab, from=c(2,2), to=c(3,3), border=wdConst$wdBorderBottom, wrd=wrd)
WrdTableBorders(wtab, from=c(2,2), to=c(3,3), border=wdConst$wdBorderDiagonalUp, wrd=wrd)

# demonstrate linewidth and color
wtab <- ToWrd(tab, wrd=wrd, tablestyle = NA)
WrdTableBorders(wtab, col=RgbToLong(ColToRgb("olivedrab")),
                lwd=wdConst$wdLineWidth150pt, wrd=wrd)

WrdTableBorders(wtab, border=wdConst$wdBorderBottom,
                col=RgbToLong(ColToRgb("dodgerblue")),
                lwd=wdConst$wdLineWidth300pt, wrd=wrd)

# use an R color in Word
RgbToLong(ColToRgb("olivedrab"))

# find a similar R-color for a Word color
ColToRgb(RgbToCol(LongToRgb(wdConst$wdColorAqua)))
}

Run the code above in your browser using DataLab