fpar: concatenate formatted text

Description Usage Arguments Details Examples

View source: R/fpar.R

Description

Create a paragraph representation by concatenating formatted text or images.

fpar supports ftext, external_img and simple strings. All its arguments will be concatenated to create a paragraph where chunks of text and images are associated with formatting properties.

Default text and paragraph formatting properties can also be modified with update.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
fpar(..., fp_p = fp_par(), fp_t = fp_text())

## S3 method for class 'fpar'
update(object, fp_p = NULL, fp_t = NULL, ...)

## S3 method for class 'fpar'
as.data.frame(x, ...)

## S3 method for class 'fpar'
format(x, type = "pml", ...)

Arguments

...

unused

fp_p

paragraph formatting properties

fp_t

default text formatting properties. This is used as text formatting properties when simple text is provided as argument.

x, object

fpar object

type

a string value ("pml", "wml" or "html").

Details

fortify_fpar, as.data.frame are used internally and are not supposed to be used by end user.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
fpar(ftext("hello", shortcuts$fp_bold()))

# mix text and image -----
img.file <- file.path( R.home("doc"), "html", "logo.jpg" )

bold_face <- shortcuts$fp_bold(font.size = 12)
bold_redface <- update(bold_face, color = "red")
fpar_1 <- fpar(
  "Hello World, ",
  ftext("how ", prop = bold_redface ),
  external_img(src = img.file, height = 1.06/2, width = 1.39/2),
  ftext(" you?", prop = bold_face ) )
fpar_1

img_in_par <- fpar(
  external_img(src = img.file, height = 1.06/2, width = 1.39/2),
  fp_p = fp_par(text.align = "center") )

officer documentation built on July 24, 2018, 9:02 a.m.