TextBlock | R Documentation |
TextBlock
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.
teal.reporter::ContentBlock
-> TextBlock
new()
Initialize a TextBlock
object.
TextBlock$new(content = character(0), style = private$styles[1])
content
(character
) a string assigned to this TextBlock
style
(character(1)
) one of: "default"
, "header2"
, "header3"
"verbatim"
Constructs a TextBlock
object with no content and the default style.
Object of class TextBlock
, invisibly.
TextBlock <- getFromNamespace("TextBlock", "teal.reporter") block <- TextBlock$new()
set_content()
Sets content of this TextBlock
.
TextBlock$set_content(content)
content
(any
) R object
self
, invisibly.
ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter") block <- ContentBlock$new() block$set_content("Base64 encoded picture")
set_style()
Sets the style of this TextBlock
.
TextBlock$set_style(style)
style
(character(1)
) one of: "default"
, "header2"
, "header3"
"verbatim"
The style has bearing on the rendering of this block.
self
, invisibly.
TextBlock <- getFromNamespace("TextBlock", "teal.reporter") block <- TextBlock$new() block$set_style("header2")
get_style()
Get the style of this TextBlock
.
TextBlock$get_style()
character(1)
the style of this TextBlock
.
TextBlock <- getFromNamespace("TextBlock", "teal.reporter") block <- TextBlock$new() block$get_style()
get_available_styles()
Get available an array of styles available to this TextBlock
.
TextBlock$get_available_styles()
A character
array of styles.
TextBlock <- getFromNamespace("TextBlock", "teal.reporter") block <- TextBlock$new() block$get_available_styles()
from_list()
Create the TextBlock
from a list.
TextBlock$from_list(x)
x
(named list
) with two fields text
and style
.
Use the get_available_styles
method to get all possible styles.
self
, invisibly.
TextBlock <- getFromNamespace("TextBlock", "teal.reporter") block <- TextBlock$new() block$from_list(list(text = "sth", style = "default"))
to_list()
Convert the TextBlock
to a list.
TextBlock$to_list()
named list
with a text and style.
TextBlock <- getFromNamespace("TextBlock", "teal.reporter") block <- TextBlock$new() block$to_list()
clone()
The objects of this class are cloneable with this method.
TextBlock$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------
## 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()
## ------------------------------------------------
## Method `TextBlock$get_available_styles`
## ------------------------------------------------
TextBlock <- getFromNamespace("TextBlock", "teal.reporter")
block <- TextBlock$new()
block$get_available_styles()
## ------------------------------------------------
## 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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.