S7 classes representing individual content items on a Google Slides slide.
Each element holds three pieces of context — the parent presentation, the
parent slide, and the API element_id — that allow any generic to fetch
the element's raw data on demand without storing a snapshot.
The concrete subclasses are:
text_element— text boxes (shape typeTEXT_BOX)image_element— inline imageschart_element— linked Google Sheets chartstable_element— tablesshape_element— other shapes (rectangles, ellipses, etc.)
Use element_type() to identify the type at runtime, and get_elements()
or get_all_elements() to obtain element objects from a slide.
Usage
element(presentation = NULL, slide = NULL, element_id = character(0))
text_element(presentation = NULL, slide = NULL, element_id = character(0))
image_element(presentation = NULL, slide = NULL, element_id = character(0))
chart_element(presentation = NULL, slide = NULL, element_id = character(0))
table_element(presentation = NULL, slide = NULL, element_id = character(0))
shape_element(presentation = NULL, slide = NULL, element_id = character(0))Arguments
- presentation
A
presentationR6 object (fromregister_presentation()ornew_presentation()).- slide
A
slideS7 object (fromon_slide_id()or similar selectors).- element_id
A single character string: the element's Google Slides object ID.
Examples
if (FALSE) {
ps <- register_presentation(id = "YOUR_PRESENTATION_ID", set_active = FALSE)
slide_obj <- on_slide_number(1, ps)
# Retrieve all elements on slide 1
els <- get_all_elements(slide_obj)
# Check the type of the first element
element_type(els[[1]])
# Filter to text elements only
text_els <- get_elements(slide_obj, type = "text")
}