ReporteRs (version 0.5)

addParagraph.docx: Insert a paragraph into a docx object

Description

Insert paragraph(s) of text into a docx object

Usage

# S3 method for docx
addParagraph (doc, value, stylename,
    bookmark, ...)

Arguments

doc

Object of class "docx" where paragraph has to be added

value

character vector containing texts to add OR an object of class set_of_paragraphs.

stylename

value of the named style to apply to paragraphs in the docx document. see styles.docx.

bookmark

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

...

further arguments, not used.

Value

an object of class "docx".

See Also

docx, addParagraph

Examples

Run this code
# NOT RUN {
#START_TAG_TEST
# Create a new document
doc = docx( title = "title" )

# Add "Hello World" into the document doc
doc <- addParagraph(doc, "Hello Word!", "Normal");

# Add into the document : "My tailor is rich" and "Cats and Dogs"
# format some of the pieces of text
pot1 = pot("My tailor", textProperties(color="red") ) + " is " + pot("rich"
	, textProperties(font.weight="bold") )
pot2 = pot("Cats", textProperties(color="red") ) + " and " + pot("Dogs"
	, textProperties(color="blue") )
my.pars = set_of_paragraphs( pot1, pot2 )

# used style is "BulletList" so that paragraphs will be preceded by bullet points
# ("BulletList" is an existing style in the defaut template docx of the package)
doc <- addParagraph(doc, my.pars, "BulletList");

writeDoc( doc, "addParagraph_example.docx" )
#STOP_TAG_TEST
# }

Run the code above in your browser using DataCamp Workspace