ContentBlock: 'ContentBlock': A building block for report content

ContentBlockR Documentation

ContentBlock: A building block for report content

Description

This class represents a basic content unit in a report, such as text, images, or other multimedia elements. It serves as a foundation for constructing complex report structures.

Methods

Public methods


Method set_content()

Sets content of this ContentBlock.

Usage
ContentBlock$set_content(content)
Arguments
content

(any) R object

Returns

self, invisibly.

Examples
ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
block <- ContentBlock$new()
block$set_content("Base64 encoded picture")


Method get_content()

Retrieves the content assigned to this block.

Usage
ContentBlock$get_content()
Returns

object stored in a private$content field

Examples
ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
block <- ContentBlock$new()
block$get_content()


Method from_list()

Create the ContentBlock from a list.

Usage
ContentBlock$from_list(x)
Arguments
x

(⁠named list⁠) with two fields text and style. Use the get_available_styles method to get all possible styles.

Returns

self, invisibly.


Method to_list()

Convert the ContentBlock to a list.

Usage
ContentBlock$to_list()
Returns

⁠named list⁠ with a text and style.


Method clone()

The objects of this class are cloneable with this method.

Usage
ContentBlock$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `ContentBlock$set_content`
## ------------------------------------------------

ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
block <- ContentBlock$new()
block$set_content("Base64 encoded picture")


## ------------------------------------------------
## Method `ContentBlock$get_content`
## ------------------------------------------------

ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
block <- ContentBlock$new()
block$get_content()


teal.reporter documentation built on April 3, 2025, 7:39 p.m.