Você está na página 1de 1

Corporate Reporting in manipulation with officer

add content add content


p %>% ph_with_text(…, str = „test“) test p %>% ph_add_par(level = 2)%>%
test Add text in new shape
using officer ,flextable, rvg and mschart * .pptx
- two
.pptx
ph_with_text(str = „two“)
basic Append a paragraph
Cheat Sheet p %>% ph_with_img(src = img.file) p %>% ph_..._at(left = …, top = …)
* piping with magrittr Add image to slide. Width and Define arbitary position
Create an R-Object
Tables with flextable p <- read_pptx( ) representing a
Powerpoint object
.pptx Height can be added .pptx

p %>% ph_with_gg(value = …) p %>% add_slide(layout =„…“, master = „…“)


basic Add a new slide
Add ggplot to slide .pptx

path = „…“ .pptx


a <- flextable( ) .pptx
Specify the initial .pptx-path p %>% remove_slide(index = …)
U V W data = x
.pptx p %>% ph_with_table(value = …) .pptx Remove a new slide
.pptx
Specify a dataset to the flextable Add table to slide
Get layout names and p %>% on_slide(index = …)
layout_summary(p) master layout names
.pptx
col_keys = c(„U“, „V“, „Q“)
U V Q .pptx Select a slide
Column names to display. Unknown p %>% ph_with_flextable(value = .pptx

columns will be displayed empty Get details about the …) Add a flextable object to a slide
layout_properties(p) available shapes .pptx p %>% ph_with_vg(code = print(x))

rvg
U cheight = … cwidth = 1.5
Add an editable ggplot graphic
initial width and height to use for
p %>% on_slide(index =1) %>% .pptx
cell sizes
print( p, ) Generate a .pptx- 1 ph_slidelink(slide_index = 2) p %>% ph_with_chart(chart = …)
.pptx
U V W part = „header“ … „body“ … „all“ file 2 .pptx
Add a slidelink

mschart
Affects area of formating target = „…“ Add a native office chart
p %>% ph_hyperlink(href =„https…)
ms_linechart( data, x, y, group)
Specify a target path
a %>% theme_booktabs() ms_barchart(…)
U VW Change order of header .pptx
ms_areachart(…)
Set theme (theme_vanilla, .pptx
theme_zebra, theme_box, …) ms_scatterchart(…)
U V W a %>% autofit()

Adjusts widths and heights


regarding to text widths and heights add content add content
manipulation with officer
layout format 1.Test
Lore
d %>% body_add_par(value = „Test“, style = …) d %>% body_end_section()
Add a paragraph of text. Styles
ipsum …
Add a section in a .docx-
a %>% merge_v(„W“) a %>% bold(part =„header“)
U V W U V basic .docx are defined by styles_info() .docx file
Merge duplicated cells for each Format strings bold
column
Create an R-Object TEST
d %>% body_add_fpar(value = „f_par“, style = …) test d %>% slip_in_img(src = …)
U V W a %>% merge_h(i = 2) a %>% italic(…) d <- read_docx( ) representing a Word
U V Add a formatted paragraph of text. Append an image into a
Merge duplicated cells for each Format strings italic object Definition of a fpar: paragraph
.docx .docx
row
f_par <- fpar(ftext(„TEST“, prop = „bold_face“))
a %>% merge_at(i = 1:2, j = 1:2) a %>% fontsize(…, size =12) path = „…“
U V W UV d %>% body_add_img(src = …) test test d %>% slip_in_test(str = „…“)
General merging Format font size Specify the initial .docx-path
.docx
Add a image to the document. Additional Append text into a
.docx arguments are style, width, height and pos .docx paragraph
a %>% set_header_labels(U = „k“) a %>% color(…, color = „red“) Read word styles
k VW U V styles_info(d)
Replace labels Format font color d %>% body_add_table(value = …) test 𝝅 d %>% slip_in_seqfield(str = …)
Add a table to the document. Further Append an seq field into a
Get details about the
a %>% add_header(U = „k“, V = „l“) a %>% bg(…, bg = „red“) doc_properties(d) .docx format and layout options are available. .docx paragraph
U V U V available shapes
Add a header row Format background color
k l
toc
d %>% body_add_toc(level = …)
a %>% add_header(top = FALSE) a %>% align(…, align = „top“) Add a table of content; level d %>% slip_in_seqfield(style = …, pos = …)
k l U V print( d, ) Generate a .docx-
specifies the max title level
Change order of header Align text („right“, „left“, .docx For some functions pos and style arguments can
U V file
„bottom“, „top“, „center“) be added:
target = „…“ pos: where to add the new element relative to
a %>% width(j = 2) a %>% border(…, border = Specify a target path d %>% body_add_break() the cursor, one of after", "before", "on".
U V W U V fp_border (color = „red“)) Add a page break style: style of the element
a %>% height(part = „header“)
Set width/ height manual Format border color .docx

CS Design: Florian Handke Learn more at davidgohel.github.io/officer • Officer 0.2.0 • Updated 12/17

Você também pode gostar