| Type: | Package | 
| Title: | R Graphics Devices for 'Office' Vector Graphics Output | 
| Version: | 0.4.0 | 
| Description: | Vector Graphics devices for 'Microsoft PowerPoint' and 'Microsoft Excel'. Functions extending package 'officer' are provided to embed 'DrawingML' graphics into 'Microsoft PowerPoint' presentations and 'Microsoft Excel' workbooks. | 
| License: | GPL-3 | 
| URL: | https://ardata-fr.github.io/officeverse/, https://davidgohel.github.io/rvg/ | 
| BugReports: | https://github.com/davidgohel/rvg/issues | 
| Depends: | R (≥ 3.0) | 
| Imports: | gdtools (≥ 0.3.3), grDevices, officer (≥ 0.6.2), Rcpp (≥ 0.12.12), rlang, systemfonts, xml2 (≥ 1.0.0) | 
| Suggests: | grid, testthat | 
| LinkingTo: | Rcpp, systemfonts | 
| Encoding: | UTF-8 | 
| RoxygenNote: | 7.3.3 | 
| SystemRequirements: | libpng | 
| NeedsCompilation: | yes | 
| Packaged: | 2025-10-05 17:02:21 UTC; davidgohel | 
| Author: | David Gohel [aut, cre], ArData [cph], Bob Rudis [ctb] (the javascript code used by function set_attr), Francois Brunetti [ctb] (clipping algorithms) | 
| Maintainer: | David Gohel <david.gohel@ardata.fr> | 
| Repository: | CRAN | 
| Date/Publication: | 2025-10-06 05:10:20 UTC | 
Defunct Functions in Package rvg
Description
Defunct Functions in Package rvg
Usage
body_add_vg(...)
Arguments
... | 
 unused argument  | 
Details
body_add_vg() is removed and can be replaced by officer::body_add_img.
Wrap plot instructions for DrawingML plotting in Powerpoint
Description
A simple wrapper to mark
the plot instructions as Vector Graphics instructions. It produces
an object of class 'dml' with a corresponding method ph_with.
The function enable usage of any R plot with argument code and with
ggplot objects with argument ggobj.
Usage
dml(
  code,
  ggobj = NULL,
  bg = "white",
  fonts = list(),
  pointsize = 12,
  editable = TRUE,
  ...
)
Arguments
code | 
 plotting instructions  | 
ggobj | 
 ggplot object to print. argument code will be ignored if this argument is supplied.  | 
bg, fonts, pointsize, editable | 
 Parameters passed to   | 
... | 
 unused arguments  | 
background color
When dealing with a ggplot object argument bg will have no effect
because ggplot theme is specifying background color, don't forget
to define the colors you want in the theme:
theme( panel.background = element_rect(fill = "#EFEFEF"), plot.background = element_rect(fill = "wheat"))
See Also
Examples
anyplot <- dml(code = barplot(1:5, col = 2:6), bg = "wheat")
library(officer)
doc <- read_pptx()
doc <- add_slide(doc, "Title and Content", "Office Theme")
doc <- ph_with(doc, anyplot, location = ph_location_fullsize())
fileout <- tempfile(fileext = ".pptx")
# fileout <- "vg.pptx"
print(doc, target = fileout)
DrawingML graphic device for Microsoft PowerPoint
Description
Graphics devices for Microsoft PowerPoint DrawingML format.
Usage
dml_pptx(
  file = "Rplots.dml",
  width = 6,
  height = 6,
  offx = 1,
  offy = 1,
  bg = "white",
  fonts = list(),
  pointsize = 12,
  editable = TRUE,
  id = 1L,
  last_rel_id = 1L,
  raster_prefix = "raster_",
  standalone = TRUE
)
Arguments
file | 
 the file where output will appear.  | 
height, width | 
 Height and width in inches.  | 
offx, offy | 
 top and left origin of the plot  | 
bg | 
 Default background color for the plot (defaults to "white").  | 
fonts | 
 Named list of font names to be aliased with
fonts installed on your system. If unspecified, the R default
families  When you use specific fonts, you will need that font installed on your system.
This can be check with package  An example:   | 
pointsize | 
 default point size.  | 
editable | 
 should vector graphics elements (points, text, etc.) be editable.  | 
id | 
 specifies a unique identifier (integer) within the slide that will contain the DrawingML instructions.  | 
last_rel_id | 
 specifies the last unique identifier (integer) within relationship file that will be used to reference embedded raster images if any.  | 
raster_prefix | 
 string value used as prefix for png files produced when raster objects are printed on the graphical device.  | 
standalone | 
 produce a standalone drawingml file? If   | 
See Also
Examples
dml_pptx(file = tempfile())
plot(1:11, (-5:5)^2, type = "b", main = "Simple Example")
dev.off()
DrawingML graphic device for Microsoft Excel
Description
Graphics devices for Microsoft Excel DrawingML format.
Usage
dml_xlsx(
  file = "Rplots.dml",
  width = 6,
  height = 6,
  offx = 1,
  offy = 1,
  bg = "white",
  fonts = list(),
  pointsize = 12,
  editable = TRUE,
  id = 1L,
  last_rel_id = 1L,
  raster_prefix = "raster_",
  standalone = TRUE
)
Arguments
file | 
 the file where output will appear.  | 
height, width | 
 Height and width in inches.  | 
offx, offy | 
 top and left origin of the plot  | 
bg | 
 Default background color for the plot (defaults to "white").  | 
fonts | 
 Named list of font names to be aliased with
fonts installed on your system. If unspecified, the R default
families   | 
pointsize | 
 default point size.  | 
editable | 
 should vector graphics elements (points, text, etc.) be editable.  | 
id | 
 specifies a unique identifier (integer) within the slide that will contain the DrawingML instructions.  | 
last_rel_id | 
 specifies the last unique identifier (integer) within relationship file that will be used to reference embedded raster images if any.  | 
raster_prefix | 
 string value used as prefix for png files produced when raster objects are printed on the graphical device.  | 
standalone | 
 produce a standalone drawingml file? If   | 
See Also
Examples
dml_xlsx(file = tempfile())
plot(1:11, (-5:5)^2, type = "b", main = "Simple Example")
dev.off()
add a plot output as vector graphics into a PowerPoint object
Description
produces a vector graphics output from R plot instructions
stored in a dml object and add the result in an rpptx
object produced by read_pptx.
Usage
## S3 method for class 'dml'
ph_with(x, value, location, ...)
Arguments
x | 
 a pptx device  | 
value | 
 
  | 
location | 
 a location for a placeholder.  | 
... | 
 Arguments to be passed to methods  | 
Examples
anyplot <- dml(code = barplot(1:5, col = 2:6), bg = "wheat")
library(officer)
doc <- read_pptx()
doc <- add_slide(doc, "Title and Content", "Office Theme")
doc <- ph_with(doc, anyplot, location = ph_location_fullsize())
fileout <- tempfile(fileext = ".pptx")
print(doc, target = fileout)
add a plot output as vector graphics into an Excel object
Description
produces a vector graphics output from R plot instructions
and add the result in an Excel sheet.
by read_xlsx.
Usage
xl_add_vg(x, sheet, code, left, top, width, height, ...)
Arguments
x | 
 an   | 
sheet | 
 sheet label/name  | 
code | 
 plot instructions  | 
left, top | 
 left and top origin of the plot on the slide in inches.  | 
height, width | 
 Height and width in inches.  | 
... | 
 arguments passed on to   | 
Examples
library(officer)
my_ws <- read_xlsx()
my_ws <- xl_add_vg(my_ws,
  sheet = "Feuil1",
  code = barplot(1:5, col = 2:6), width = 6, height = 6, left = 1, top = 2
)
fileout <- tempfile(fileext = ".xlsx")
print(my_ws, target = fileout)