Skip to contents

get a htmltools::div() from a flextable object. This can be used in a shiny application. For an output within "R Markdown" document, use knit_print.flextable.

Usage

htmltools_value(
  x,
  ft.align = NULL,
  ft.shadow = NULL,
  extra_dependencies = NULL
)

Arguments

x

a flextable object

ft.align

flextable alignment, supported values are 'left', 'center' and 'right'.

ft.shadow

deprecated.

extra_dependencies

a list of HTML dependencies to add in the HTML output.

Value

an object marked as htmltools::HTML ready to be used within a call to shiny::renderUI for example.

Examples

htmltools_value(flextable(iris[1:5, ]))
#> <style></style>
#> <div class="tabwid"><style>.cl-5c904626{}.cl-5c8a9316{font-family:'Liberation Sans';font-size:11pt;font-weight:normal;font-style:normal;text-decoration:none;color:rgba(0, 0, 0, 1.00);background-color:transparent;}.cl-5c8cfa7a{margin:0;text-align:right;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:5pt;padding-top:5pt;padding-left:5pt;padding-right:5pt;line-height: 1;background-color:transparent;}.cl-5c8cfa8e{margin:0;text-align:left;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:5pt;padding-top:5pt;padding-left:5pt;padding-right:5pt;line-height: 1;background-color:transparent;}.cl-5c8d1460{width:0.75in;background-color:transparent;vertical-align: middle;border-bottom: 1.5pt solid rgba(102, 102, 102, 1.00);border-top: 1.5pt solid rgba(102, 102, 102, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-5c8d146a{width:0.75in;background-color:transparent;vertical-align: middle;border-bottom: 1.5pt solid rgba(102, 102, 102, 1.00);border-top: 1.5pt solid rgba(102, 102, 102, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-5c8d1474{width:0.75in;background-color:transparent;vertical-align: middle;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-5c8d1475{width:0.75in;background-color:transparent;vertical-align: middle;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-5c8d147e{width:0.75in;background-color:transparent;vertical-align: middle;border-bottom: 1.5pt solid rgba(102, 102, 102, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-5c8d147f{width:0.75in;background-color:transparent;vertical-align: middle;border-bottom: 1.5pt solid rgba(102, 102, 102, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}</style><table data-quarto-disable-processing='true' class='cl-5c904626'><thead><tr style="overflow-wrap:break-word;"><th class="cl-5c8d1460"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">Sepal.Length</span></p></th><th class="cl-5c8d1460"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">Sepal.Width</span></p></th><th class="cl-5c8d1460"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">Petal.Length</span></p></th><th class="cl-5c8d1460"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">Petal.Width</span></p></th><th class="cl-5c8d146a"><p class="cl-5c8cfa8e"><span class="cl-5c8a9316">Species</span></p></th></tr></thead><tbody><tr style="overflow-wrap:break-word;"><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">5.1</span></p></td><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">3.5</span></p></td><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">1.4</span></p></td><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">0.2</span></p></td><td class="cl-5c8d1475"><p class="cl-5c8cfa8e"><span class="cl-5c8a9316">setosa</span></p></td></tr><tr style="overflow-wrap:break-word;"><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">4.9</span></p></td><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">3.0</span></p></td><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">1.4</span></p></td><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">0.2</span></p></td><td class="cl-5c8d1475"><p class="cl-5c8cfa8e"><span class="cl-5c8a9316">setosa</span></p></td></tr><tr style="overflow-wrap:break-word;"><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">4.7</span></p></td><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">3.2</span></p></td><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">1.3</span></p></td><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">0.2</span></p></td><td class="cl-5c8d1475"><p class="cl-5c8cfa8e"><span class="cl-5c8a9316">setosa</span></p></td></tr><tr style="overflow-wrap:break-word;"><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">4.6</span></p></td><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">3.1</span></p></td><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">1.5</span></p></td><td class="cl-5c8d1474"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">0.2</span></p></td><td class="cl-5c8d1475"><p class="cl-5c8cfa8e"><span class="cl-5c8a9316">setosa</span></p></td></tr><tr style="overflow-wrap:break-word;"><td class="cl-5c8d147e"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">5.0</span></p></td><td class="cl-5c8d147e"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">3.6</span></p></td><td class="cl-5c8d147e"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">1.4</span></p></td><td class="cl-5c8d147e"><p class="cl-5c8cfa7a"><span class="cl-5c8a9316">0.2</span></p></td><td class="cl-5c8d147f"><p class="cl-5c8cfa8e"><span class="cl-5c8a9316">setosa</span></p></td></tr></tbody></table></div>