addParagraph-methods: Insert a paragraph of text into the docx document

Description Usage Arguments Details Examples

Description

Insert a paragraph of text into a Docx object.

Usage

1
2
  ## S4 method for signature 'Docx, character, character, list, list, character'
addParagraph(x, value, stylename, replacements, replacement.styles, bookmark)

Arguments

x

the Docx to use

value

character vector containing texts to add.

stylename

value of the named style in the docx document.

replacements

optional, a named list whose elements define replacements values.

replacement.styles

optional, a named list specifying formats to apply to replacements.

bookmark

a character value ; id of the Word bookmark to replace by the table. optional

Details

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
doc <- new("Docx", title = "My example" )

doc <- addParagraph( doc, value = "Hello", stylename = "Normal")




x = c( "[animal] eat [food].", "tigers eat [animal]." )

repl.styles = list(
		  animal= textProperties( font.size = 12, font.family="Courier New", color="red" )
		, food= textProperties( font.size = 12, font.family="Courier New", color="blue" )
)
repl = list( animal = "buffalos" , food = "grass" )

doc <- addParagraph( doc, value = x, stylename = "Normal"
		, replacements = repl
		, replacement.styles = repl.styles
)
doc <- addParagraph( doc, value = letters[1:10], stylename = "BulletList")

## Not run: 
writeDoc( doc, "Paragraph_example.docx" )

## End(Not run)

davidgohel/R2DOCX documentation built on May 14, 2019, 11:13 p.m.