Specialized ContentBlock
for embedding styled text within reports.
It supports multiple styling options to accommodate various text roles,
such as headers or verbatim text, in the report content.
Super class
teal.reporter::ContentBlock
-> TextBlock
Methods
Inherited methods
Method new()
Initialize a TextBlock
object.
Arguments
content
(
character
) a string assigned to thisTextBlock
style
(
character(1)
) one of:"default"
,"header2"
,"header3"
"verbatim"
Examples
TextBlock <- getFromNamespace("TextBlock", "teal.reporter")
block <- TextBlock$new()
Method set_content()
Sets content of this TextBlock
.
Examples
ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
block <- ContentBlock$new()
block$set_content("Base64 encoded picture")
Method set_style()
Sets the style of this TextBlock
.
Examples
TextBlock <- getFromNamespace("TextBlock", "teal.reporter")
block <- TextBlock$new()
block$set_style("header2")
Method get_style()
Get the style of this TextBlock
.
Examples
TextBlock <- getFromNamespace("TextBlock", "teal.reporter")
block <- TextBlock$new()
block$get_style()
Method get_available_styles()
Get available an array of styles available to this TextBlock
.
Examples
TextBlock <- getFromNamespace("TextBlock", "teal.reporter")
block <- TextBlock$new()
block$get_available_styles()
Method from_list()
Create the TextBlock
from a list.
Arguments
x
(
named list
) with two fieldstext
andstyle
. Use theget_available_styles
method to get all possible styles.
Examples
TextBlock <- getFromNamespace("TextBlock", "teal.reporter")
block <- TextBlock$new()
block$from_list(list(text = "sth", style = "default"))
Method to_list()
Convert the TextBlock
to a list.
Examples
TextBlock <- getFromNamespace("TextBlock", "teal.reporter")
block <- TextBlock$new()
block$to_list()
Examples
## ------------------------------------------------
## Method `TextBlock$new`
## ------------------------------------------------
TextBlock <- getFromNamespace("TextBlock", "teal.reporter")
block <- TextBlock$new()
## ------------------------------------------------
## Method `TextBlock$set_content`
## ------------------------------------------------
ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
block <- ContentBlock$new()
block$set_content("Base64 encoded picture")
## ------------------------------------------------
## Method `TextBlock$set_style`
## ------------------------------------------------
TextBlock <- getFromNamespace("TextBlock", "teal.reporter")
block <- TextBlock$new()
block$set_style("header2")
## ------------------------------------------------
## Method `TextBlock$get_style`
## ------------------------------------------------
TextBlock <- getFromNamespace("TextBlock", "teal.reporter")
block <- TextBlock$new()
block$get_style()
#> [1] "default"
## ------------------------------------------------
## Method `TextBlock$get_available_styles`
## ------------------------------------------------
TextBlock <- getFromNamespace("TextBlock", "teal.reporter")
block <- TextBlock$new()
block$get_available_styles()
#> [1] "default" "header2" "header3" "verbatim"
## ------------------------------------------------
## Method `TextBlock$from_list`
## ------------------------------------------------
TextBlock <- getFromNamespace("TextBlock", "teal.reporter")
block <- TextBlock$new()
block$from_list(list(text = "sth", style = "default"))
## ------------------------------------------------
## Method `TextBlock$to_list`
## ------------------------------------------------
TextBlock <- getFromNamespace("TextBlock", "teal.reporter")
block <- TextBlock$new()
block$to_list()
#> $text
#> character(0)
#>
#> $style
#> [1] "default"
#>