Skip to contents

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


Method new()

Initialize a ContentBlock object.

Usage

Details

Returns a ContentBlock object with no content and the default style.

Returns

Object of class ContentBlock, invisibly.

Examples

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


Method set_content()

Sets content of this ContentBlock.

Usage

ContentBlock$set_content(content)

Arguments

content

(character(0) or character(1)) string or file path assigned to this ContentBlock

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

character string or file path assigned to this ContentBlock.

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$new`
## ------------------------------------------------

ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
ContentBlock$new()
#> <ContentBlock>
#>   Public:
#>     clone: function (deep = FALSE) 
#>     from_list: function (x) 
#>     get_content: function () 
#>     initialize: function () 
#>     set_content: function (content) 
#>     to_list: function () 
#>   Private:
#>     content: 
#>     deep_clone: function (name, value) 


## ------------------------------------------------
## 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()
#> character(0)