# NOT RUN {
# define some text
sometext <- c( "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"In sit amet ipsum tellus. Vivamus dignissim arcu sit amet faucibus auctor.",
"Quisque dictum tristique ligula.")
# "My tailor is rich" with formatting on some words
pot1 <- pot("My tailor", textProperties(color = "red" ) ) +
" is " + pot("rich", textProperties(shading.color = "red",
font.weight = "bold" ) )
# "Cats and dogs" with formatting on some words
pot2 = pot("Cats", textProperties(color = "red" ) ) +
" and " +
pot("dogs", textProperties( color = "blue" ),
hyperlink = "http://www.wikipedia.org/" )
# create a set of paragraphs made of pot1 and pot2
my.pars <- set_of_paragraphs( pot1, pot2 )
# docx example ---------
# }
# NOT RUN {
doc.filename = "ex_paragraph.docx"
doc <- docx()
styles(doc)
doc <- addTitle( doc, "Title example 1", level = 1 )
# Add "Hello World" into the document doc
doc <- addParagraph(doc, "Hello Word", stylename = "Normal" )
doc <- addTitle( doc, "Title example 2", level = 1 )
# add sometext with stylename BulletList
doc <- addParagraph( doc, value = sometext, stylename="BulletList" )
doc <- addTitle( doc, "Title example 3", level = 1 )
doc <- addParagraph( doc, value = my.pars, par.properties = parCenter() )
writeDoc( doc, file = doc.filename )
# }
# NOT RUN {
# pptx example -------
doc.filename = "ex_paragraph.pptx"
doc <- pptx()
doc <- addSlide(doc, "Title and Content")
# Add "Hello World" into the document doc
doc <- addParagraph(doc, "Hello Word" )
doc <- addSlide(doc, "Title and Content")
doc <- addParagraph( doc, value = my.pars )
# Add my.pars into the document doc
doc <- addParagraph(doc, my.pars, offx = 3, offy = 3,
width = 2, height = 0.5,
par.properties=parProperties(text.align="center", padding=0) )
doc <- addSlide(doc, "Title and Content")
# Add my.pars into the document doc
doc <- addParagraph(doc, my.pars,
par.properties=parProperties(text.align="center", padding=24) )
writeDoc( doc, file = doc.filename )
# }
Run the code above in your browser using DataLab