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

htmltools_value(x, ft.align = "center", ft.shadow = TRUE, ft.htmlscroll = TRUE)

Arguments

x

a flextable object

ft.align

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

ft.shadow

use shadow dom, this option is existing to disable shadow dom (set to FALSE) for pagedown that can not support it for now.

ft.htmlscroll

add a scroll if table is too big to fit into its HTML container, default to TRUE.

Value

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

Examples

htmltools_value(flextable(iris[1:5,]))
#> <template id="c027df6b-d594-40ed-b42f-094cb8151e41"><style>
#> .tabwid table{
#>   border-spacing:0px !important;
#>   border-collapse:collapse;
#>   line-height:1;
#>   margin-left:auto;
#>   margin-right:auto;
#>   border-width: 0;
#>   display: table;
#>   margin-top: 1.275em;
#>   margin-bottom: 1.275em;
#>   border-color: transparent;
#> }
#> .tabwid_left table{
#>   margin-left:0;
#> }
#> .tabwid_right table{
#>   margin-right:0;
#> }
#> .tabwid td {
#>     padding: 0;
#> }
#> .tabwid a {
#>   text-decoration: none;
#> }
#> .tabwid thead {
#>     background-color: transparent;
#> }
#> .tabwid tfoot {
#>     background-color: transparent;
#> }
#> .tabwid table tr {
#> background-color: transparent;
#> }
#> </style><div class="tabwid"><style>.cl-e4e35f42{}.cl-e4de162c{font-family:'DejaVu Sans';font-size:11pt;font-weight:normal;font-style:normal;text-decoration:none;color:rgba(0, 0, 0, 1.00);background-color:transparent;}.cl-e4de264e{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-e4de2658{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-e4de5ccc{width:54pt;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-e4de5cd6{width:54pt;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-e4de5ce0{width:54pt;background-color:transparent;vertical-align: middle;border-bottom: 2pt 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-e4de5ce1{width:54pt;background-color:transparent;vertical-align: middle;border-bottom: 2pt 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-e4de5cea{width:54pt;background-color:transparent;vertical-align: middle;border-bottom: 2pt solid rgba(102, 102, 102, 1.00);border-top: 2pt 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-e4de5cf4{width:54pt;background-color:transparent;vertical-align: middle;border-bottom: 2pt solid rgba(102, 102, 102, 1.00);border-top: 2pt 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;}</style><table class='cl-e4e35f42'><thead><tr style="overflow-wrap:break-word;"><td class="cl-e4de5cea"><p class="cl-e4de264e"><span class="cl-e4de162c">Sepal.Length</span></p></td><td class="cl-e4de5cea"><p class="cl-e4de264e"><span class="cl-e4de162c">Sepal.Width</span></p></td><td class="cl-e4de5cea"><p class="cl-e4de264e"><span class="cl-e4de162c">Petal.Length</span></p></td><td class="cl-e4de5cea"><p class="cl-e4de264e"><span class="cl-e4de162c">Petal.Width</span></p></td><td class="cl-e4de5cf4"><p class="cl-e4de2658"><span class="cl-e4de162c">Species</span></p></td></tr></thead><tbody><tr style="overflow-wrap:break-word;"><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">5.1</span></p></td><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">3.5</span></p></td><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">1.4</span></p></td><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">0.2</span></p></td><td class="cl-e4de5cd6"><p class="cl-e4de2658"><span class="cl-e4de162c">setosa</span></p></td></tr><tr style="overflow-wrap:break-word;"><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">4.9</span></p></td><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">3.0</span></p></td><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">1.4</span></p></td><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">0.2</span></p></td><td class="cl-e4de5cd6"><p class="cl-e4de2658"><span class="cl-e4de162c">setosa</span></p></td></tr><tr style="overflow-wrap:break-word;"><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">4.7</span></p></td><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">3.2</span></p></td><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">1.3</span></p></td><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">0.2</span></p></td><td class="cl-e4de5cd6"><p class="cl-e4de2658"><span class="cl-e4de162c">setosa</span></p></td></tr><tr style="overflow-wrap:break-word;"><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">4.6</span></p></td><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">3.1</span></p></td><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">1.5</span></p></td><td class="cl-e4de5ccc"><p class="cl-e4de264e"><span class="cl-e4de162c">0.2</span></p></td><td class="cl-e4de5cd6"><p class="cl-e4de2658"><span class="cl-e4de162c">setosa</span></p></td></tr><tr style="overflow-wrap:break-word;"><td class="cl-e4de5ce0"><p class="cl-e4de264e"><span class="cl-e4de162c">5.0</span></p></td><td class="cl-e4de5ce0"><p class="cl-e4de264e"><span class="cl-e4de162c">3.6</span></p></td><td class="cl-e4de5ce0"><p class="cl-e4de264e"><span class="cl-e4de162c">1.4</span></p></td><td class="cl-e4de5ce0"><p class="cl-e4de264e"><span class="cl-e4de162c">0.2</span></p></td><td class="cl-e4de5ce1"><p class="cl-e4de2658"><span class="cl-e4de162c">setosa</span></p></td></tr></tbody></table></div></template>
#> <div class="flextable-shadow-host" id="4c10c199-8b73-49a5-83cc-f8c0c8d186c1"></div>
#> <script>
#> var dest = document.getElementById("4c10c199-8b73-49a5-83cc-f8c0c8d186c1");
#> var template = document.getElementById("c027df6b-d594-40ed-b42f-094cb8151e41");
#> var caption = template.content.querySelector("caption");
#> if(caption) {
#>   caption.style.cssText = "display:block;text-align:center;";
#>   var newcapt = document.createElement("p");
#>   newcapt.appendChild(caption)
#>   dest.parentNode.insertBefore(newcapt, dest.previousSibling);
#> }
#> var fantome = dest.attachShadow({mode: 'open'});
#> var templateContent = template.content;
#> fantome.appendChild(templateContent);
#> </script>
#>