seqfield argument in run_word_field() and remove run_seqfield()
(old duplicate of run_word_field()) .RTF sections were debugged and now behave correctly: page orientation, columns, margins and per-section headers / footers all apply as expected, including multi-column layouts (#726, thanks to Nathan Kosiba).
New paragraph style API for RTF, aligned with docx_set_paragraph_style()
on the Word side. rtf_set_paragraph_style() is now exported and takes
style_id, style_name, base_on, fp_p, fp_t and outline_level;
rtf_styles_info() returns the document's style table. rtf_add() accepts
a style argument so paragraphs (character, factor, double, fpar,
block_list) can reference a named style. rtf_doc() registers built-in
"heading 1" / "heading 2" / "heading 3" styles with \outlinelevel
values, so styled paragraphs feed Word's navigation pane and TOC field.
Use rtf_set_paragraph_style() after rtf_doc() to override a built-in
style; the row keyed by style_id is updated in place.
rtf_add() now accepts [block_toc()] objects and emits a TOC field
in the RTF stream, in parity with body_add_toc() for Word. Word
populates the table at open time using the outline levels carried by
the built-in heading styles; LibreOffice does not render the TOC
automatically.
sheet_add_drawing() can now be anchored to cells. Pass
anchor = "B2:H20" (a cell range) to make the drawing move and
size with cells, Excel's default behaviour. Pass anchor = "B2"
(a single cell) to make it move but keep its own size. Omit
anchor for the previous fixed-position layout. The edit_as
argument controls what happens when rows or columns are resized.
The same options are available to charts inserted via 'mschart'.ooxml_chart_uris() returns the
identifiers needed by xlsx_drawing to wire either family.solid_fill(color) returns a DrawingML
solid-fill fragment with optional alpha; to_pml() now has an
sp_line method exposing line-properties conversion that was
previously internal.sheet_write_data() and sheet_add_drawing() for writing
data and inserting drawings (charts, vector graphics) into xlsx workbooks.
sheet_write_data() is an S3 generic: beside data.frame, it also accepts
a character vector (one cell per element, vertical by default;
direction = "horizontal" for a row), an [fpar()] (richtext inline cell honouring
bold, italic, underline, strikethrough, size, colour, font, sub/superscript)
and a [block_list()] (one cell per fpar item, stacked).
sheet_add_drawing() has an external_img method and a gg method.sheet_remove() to delete a sheet from an xlsx workbook.
add_sheet() is purely additive and never drops any sheet; call
sheet_remove() explicitly if the template's default sheet is not wanted.write_docx_settings() now preserves the existing settings.xml
content instead of rebuilding it from scratch. This fixes the loss of
embedded font settings, math properties, footnote/endnote settings and
other XML elements during docx roundtrips (#554).docx_embed_font() to embed TrueType or OpenType font
files into Word documents. Embedded fonts ensure correct rendering on
systems where the font is not installed (#554).list_item(), block_list_items() and
body_add_list() to create bullet or numbered lists with rich text
(fpar) and multi-level nesting. Works in both Word and PowerPoint
documents (#314).fp_par() and fp_par_lite() gain first_line and hanging
arguments to control paragraph first-line and hanging indents (in
points). Honored by the Word, PowerPoint, HTML and RTF renderers.
hanging wins when both are provided (flextable #704).sheet_select() now deselects other sheets, fixing the issue where
multiple tabs appeared selected when opening the workbook.remove_slide() now supports deletion of multiple slides
thanks to Wahiduzzaman Khan (#691).cursor_reach_index() to set the cursor at a specific index position in
the document (#574).set_doc_properties() gains a new argument hyperlink_base to set the base
URL for relative hyperlinks in Word documents. doc_properties() now returns
the HyperlinkBase property when available (#630).remove_field argument of function docx_summary() now work as expected.sanitize_images() (#708).docx_reference_img().docx_summary().fp_par_lite() management of argument tabs.base64_to_image(), as_base64(), from_base64()
and plot_in_png().floating_external_img() to add a floating image in a 'Word'
document.docx_summary(): the function now provide more run-level
information (text formatting, images, hyperlinks, bookmarks).sanitize_images(): the function now works as expected. It will
be unexported soon since it is now automatically called before writing documents
and is therefore no longer useful to end users.slip_in* functions.write_elements_to_context()body_import_docx() thanks to Sean Anderson.docx_set_settings() to set document settings of a Word document.
This function can be used to specify if the document should handle odd and even headers and footers,
to change the list separator, etc.body_import_docx() to import content from an external Word document.fp_text() now supports strike argument to set strikethrough text.ph_with() now handles Date objects without prior conversion to character.
The date format can be set locally via the date_format arg or globally via
options(officer.date_format = ...) (#683)fpar() so that no stylename is used.set_doc_properties() error and warning messages.page_size() now manage correctly sizes if orient = "landscape" and not
unit = "in".phs_with() and add_slide() now have a more informative error message if
the ph label is unknown (#672)set_doc_properties() now supports NULL and NA custom properties in
a Word document.separator is not used anymore in block_toc. Now the Word field is
generated with no separator making it more portable over the different locales
Word users could have.fp_par_lite() works also for RTF output.doc_summary(... detailed=TRUE) when the runs has a shading (w:shd) with
a fill but no color attribute.plot_layout_properties(): new slide_idx arg to specify which slide's layout
to plot. The plot title now also contains the master's name (#666)body_append_start_context(), write_elements_to_context() and
body_append_stop_context() to append elements at the end of a Word document
in a faster way. This is useful when the document is large and the user wants to
only append elements at the end of the document.block_gg() to add a ggplot object to a Word document. It is
handy when the user wants to add a ggplot object to a Word document with
new function write_elements_to_context().fp_par_lite() to create a paragraph formatting object with only the
properties that are needed. It is useful when the user wants to create a
paragraph object with only the properties that are needed and not all the
properties. It can also be used to create a paragraph formatting object
that reuse a style but with some modifications.print.rdocx() gains new arguments copy_header_refs and
copy_footer_refs to copy header and footer references from the
default section to other sections. This should be useful when the user
wants to add sections but also propagate the header and footer references.body_add.block_list() to speed up the process of adding a block
list to a Word document, optimization of the process is made by minimizing call
to docx_current_block_xml().print.rdocx() execution time improvements.add_slide(): It now suffices to specify a unique layout. The master will be inferred automatically.layout ("Title and Content") and master ("Office Theme") arg were removed.
They only applied to the default pptx template used by read_pptx(). To avoid breaking changes in old code,
add_slide() now throws a deprecation warning, if no layout is specified (either via the layout arg or by setting
a default layout). It then uses the layout arg's former default value ("Title and Content"). This makes sure,
that the behavior of add_slide() does not change and avoids backward compatibility issues (#635)layout_default() sets a default layout for add_slide() (#635).print.rpptx now uses pluralization and marks the default layout (if set by layout_default()) with an asterisk (#635)docx_summary() when a text run is associated with a text style and
when paragraph or text styles are not registered in the Word document style
table (thanks to Kaspar Meili).plot_layout_properties() now takes cex as a vector or a list and matches by position, name or partial name.
Zero values now hide the text. A single value now applies to all three cex parameters (label, type, and id) (#645)plot_layout_properties() now shows the default layout, if one is set and there are not slides yet (#645)11906 / 1440 and 16838 / 1440
instead of 21 / 2.54 and 29.7 / 2.54.docx_reference_img() as it is no longer useful..location arg in ph_with_* functions (#623). Instead of a location object
created by the ph_location_* function family, ph_with_* functions now resolves certain short form
input into corresponding location objects. For example, instead of using ph_location_label("<label>")
you can now simply pass the "<label>" to the location arg. The functionn will convert the string into
the corresponding location object automatically. Other examples are "body [1]" for
ph_location_type(type = "body", type_idx = 1), or the integer 1 for ph_location_id(id = 1)slide_visible() to get and set the visibility of slides (#622).ph_remove() (see #625) that was not working for rvg outputs.phs_with: filling multiple placeholders on one or more slides at once using key-value pair syntax (#639).add_slide: new args ... and .dots, both passed to phs_with to create slide and fill placeholders in one step (#639).docx_summary() now also removes "w:fldData" nodes.body_add_docx() with a note about the file basename
that can not contain ' ' and trigger an error if it contains a ' '.plot_layout_properties() gains a 'title' parameter, which will add the layout name as the plot title. Defaults to
FALSE, to not alter the old behavior. Also, the slide width and height are now correctly displayed in the plot.
Before, a box was drawn around the plot area. However, the plot area var with device size, not slide size.dir_collection: Files are now added to a container in the order of their trailing numeric index (#596).
For example, slideLayout2.xml will now preceed slideLayout10.xml. Before, alphabetical sorting was used, where
slideLayout10.xml comes before slideLayout2.xml.layout_properties() now returns all placeholders in case of multiple master (#597). Also, the internal xfrmize()
now sorts the resulting data by placeholder position. This yields an intuitive order, with placeholders sorted from
top to bottom and left to right.ph_location_type() now throws an error if the id for a type is out of range (#602) and a more
informative error message if the type is not present in layout (#601).plot_layout_properties() assignment order fixed for labels= FALSE (#604)layout_properties() gains a type_idx column to index phs of the same type on a layout. Indexing is performed based on ph position, following a top-to-bottom, left-to-right order (#606).plot_layout_properties() plots more information by default now: layout name, ph label, ph id, ph type + index by default (#606).ph_location_type(): new type_idx arg replaces the deprecated id arg (#606).ph_location_id() as a new member to the ph_location_* family. It references a placeholder via its unique id (#606).plot_layout_properties(): Now accepts the layout index (see layout_summary()) as an alternative to the layout name.
Gains an argument legend to add a legend to the plot. Also prints the current slide's layout by
default now, if not layout name is provided explicitly (#595).layout_rename_ph_labels() to rename ph labels (#610).layout_dedupe_ph_labels() to handle duplicate placeholder labels (#589).
By default, it will only detect duplicate labels, but apply no changes. With
action = "rename", it auto-renames duplicate labels and action = "delete"
deletes duplicates, only keeping their first occurrence.body_replace_gg_at_bkm() and body_replace_plot_at_bkm()
to replace text content enclosed in a bookmark with a ggplot or a base plot.unit (in, cm, mm) argument in function page_size().docx_summary preserves non-breaking hyphens. Non-breaking hyphens are
replaced with a hyphen-minus (Unicode character 002D). Closes #573.docx_summary() gains parameter 'detailed' which allows to get a detailed
summary including formatting properties of runs in a paragraph. Formatting
properties are stored in a list column run, where each element
is a dataframe with rows corresponding to a single
run and columns containing the information on formatting properties.block_pour_docx() to avoid working with file paths
containing '&'.cursor_reach() gains new argument fixed to enable exact matching.
It defaults to FALSE for backward compatibility.remove_slide() gains new argument rm_images to enable images deletion
from ppt/media.body_comment() adds a comment on an existing paragraph
at the cursor position.docx_summary() gains parameter 'remove_field' to prevent field codes
from appearing in the returned data.frame.fp_tabs() to enable tabulation marks settings
with flextable (for Word and RTF).\(x) syntaxfp_border() gains support for all line border styles listed in ECMA-376
section 17.18.2 and allowed CSS border styles. Closes #165 and #443.docx_comments() gains a list column para_id containing
the id(s) of the parent paragraph(s). A possible breaking change is that the commented_text
is now returned as a list column to account for comments spanning multiple runs.
The docs gain a description of the columns of the returned dataframe.opts_current_table() now ignore 'Quarto' setting.docx_comments() to (properly) account for comments spanning
multiple paragraphs, multiple comments in the same paragraph and replies. Closes #541.fp_text_lite() is using a shading.color but no color.body_add_caption().ph_remove(), ph_slidelink() and ph_hyperlink() that were not working since
the latest refactoring.stlname if available in docx_summary().file.copy(from = "template/*.xml") are now done with argument
copy.mode = FALSE for compatibility with 'nix'.run_comment() to create a run with a comment.docx_comments() to read comments in a Word document as a data.frame.is_doc_open() replaces is_office_doc_edited() to check if a document is open on Windows. This solves the issue where RStudio crashed while trying to write to an open Office document.preserve to preserve cell line breaks to docx_summary().ph_hyperlink() when several hyperlinks are inside one slide and refactored ph_remove().image_read_svg()
when source is SVG in external_img().block_list().run_autonum() and run_reference(),
this enables captions support for flextable.slip_in_footnote().to_wml.block_caption()rtf_doc() and rtf_add().image_to_base64() and uuid_generate() as a tool
for other 'officeverse' packages.process_stylenames(),
this allow to depend on a reference doc (now convert_custom_styles_in_wml()).guess_size=TRUE, image
size is read and do not need to be provided.body_add() content order.run_autonum() and add tests.$get_at_cursor()get_at_cursor()shape_properties_tags() for pptx extentions.docx_set_character_style() to add or
replace a Word character style.docx_set_paragraph_style() to add or
replace a Word paragraph style.run_wordtext() to add a chunk of text
associated with a Word character style.potx and dotx files are now supported.prop_section().cursor_reach_test() to test if an expression has
a match in the document.docx_current_block_xml() to let developpers access
the xml content where the cursor is.ph_with.xml_document now manages images paths in slide and
treats them in the relevant documents.pos='before', cursor
is now set on element added 'before'. Internals about
cursors have been refactored.slip_in_footnote() is deprecated. Use run_footnote() instead.fp_par() now have argument word_styleln for external_img provided by Angus Mooreprop_table()).
These values can be used as alternative text for Word tables. These values
can also be set as "knitr" chunk options.is_office_doc_edited() provided by Andrew Tungate.tab.lp is no more set to null with usual rmarkdown outputsopts_current_table() read some Quarto values related to
captions in order to reuse them later.set_doc_properties() now supports any character property.
It provides an easy way to insert arbitrary fields. Given the challenges
that can be encountered with find-and-replace in word with officer, the
use of document fields and quick text fields provides a much more robust
approach to automatic document generation from R.empty_content().ph_location(geam=...).slip_in_img(), ph_add_fpar(),
ph_add_par() and ph_add_text()ph_with.external_img() that could be seen when alt_text was nulltab.cap.sep from ":" to ": "body_end_section_columns() that is expected as 'continuous'.scale added to ph_with.gg, body_add_gg and body_add.gg
to set the scale of ggplot outputs (like in ggsave).set_autonum_bookmark() to recycle an object
made by run_autonum() by changing the bookmark value.tnd argument to prefix a autonumber with the
title number (i.e. 4.3-2 for figure 2 of chapter 4.3).unordered_list() now supports level_list < 1 which
will be interpreted as 'no bullet'.tab.cap.fp_text to let format caption prefix
in function opts_current_table().slip_in*() and ph_add*() functions. Functions ftext() and related
used with fpar() are to be used as replacement.fp_text_lite() that do not force to provide a value
for each properties - if a value is not provided, its attribute will
not be written and as a result, the default properties will be applied.
Function fp_text() has also been adapted, it now supports NA meaning
to not write the attributes as in fp_text_lite().run_footnote to add footnotes in a Word document (it
also makes possible to deprecate totally slip_in* functions).run_autonum gained new argument start_at.tab.topcaption is now supported by opts_current_table()get_reference_value - fix - if reference_data is not an existing file,
it is appened to opts_knit$get("output.dir").The sections are now corrected as follow, each section will be completed with the values of the default section if the value is missing. This should solve issue that lot of users have with page breaks when using sections. Now page breaks should disappear.
fp_text gained arguments to specify different fonts when mixing
CJK and latin characters: cs.family, eastasia.family, hansi.family.hyperlink_ftext().body_add_plot() and body_add_caption()run_bookmark() to create a run with a bookmark.body_set_default_section() that changes default section properties
of a Word document.to_wml.block_table.normalizePath.run_word_field will supersed run_seqfield.prop of ftext() now default to NULLtable_stylenames() to define columns stylenames to be used in
tables, it benefits to block_table and body_add_table.fp_parfp_text.body_end_block_section and body_add.block_section so that users are free to add any
section they wantlevel_list in function ph_with.block_list ; you can now format block_list
as lists in PowerPoint.body_add_table, ph_with.data.frame, body_add.data.frame get
new argument alignment for column alignments.block_table()) with table parameters such as width, layout. See prop_table().plot_layout_properties() to help identifying placeholders on layoutsbody_add_blocks and body_add_gg as it generated issues with cursorget_reference_value to read reference template used
by R Markdown.fp_par now have an argument "keep_with_next" that specifies that the paragraph (or at least
part of it) should be rendered on the same page as the next paragraph when possible.body_add and associated methodsid_chr is now depreacted in favor of id in function ph_remove, ph_slidelink, ph_hyperlink,
ph_add_text, ph_add_par, ph_add_fpar.ph_with.xml_document that will replace ph_with and ph_with_at.ph_with function.sanitize_images to avoid file size inflation when replacing imagesexternal_img size issue with method ph_with.ph_with() and function ph_location*() to ease insertion
of elements.slide_size() provide size of slides.change_styles() to change paragraph styles in
a Word document.move_slide(): move a slide in a presentation.tempdir().body_add_fpar() when argument style was used.slide_summary was using a bad xpath query.headers_replace* and footers_replace*layout_properties when master layout is empty.ph_fpars_at() to add several formated paragraphs
in a new shape.basename()spptx_summary()body_replace_all_text() to replace
any text in a Word documentph_with_gg() and ph_with_gg_at() to make easier
production of ggplot objects in PowerPointph_with_ul() to make easier
production of unordered lists of text in PowerPointbody_replace_at to replace text inside bookmarkbody_add_table and ph_with_table.layout_properties now returns placeholder id when available.ph_empty_at can now make new shapes inherit
properties from templatebody_default_sectionbreak_column to break_column_before.body_end_section is supposed to only work with cursor on a paragraph, an error is raised now if ending a section on something else than a paragraph.docx_summary and pptx_summary to import content of an Office document into a tidy data.frame.docx_dim() is returning current page dimensions.set_doc_properties and doc_properties to let you modify/access metadata of Word and PowerPoint documents.body_bookmark and cursor_bookmark).ph_empty_at, ph_with_img_at and ph_with_table_at).style of functions body_add* and slip_in* now will use docx default style if not specifieddocx and pptx have been renamed rdocx and pptx to avoid conflict with package ReporteRs.