Writing
HTMLTables.writetable
— Functionwritetable(
out,
tbl;
header::Bool=true,
footer::Bool=true,
id::Union{Nothing,String}=nothing,
class::Union{Nothing,String,Vector{String}}=nothing,
caption::Union{Nothing,String}=nothing,
editable::Bool=false,
tooltips::Bool=true,
js::Union{Nothing,String}=nothing,
css::Union{Nothing,String}=nothing,
theme::Union{Nothing,String,Symbol}=:default,
colorscale::Union{Nothing,String,Symbol}=nothing
)
Uses the Tables.jl interface to write an HTML table.
Arguments
out
: accepts the same types asBase.write
.tbl
: the table to write.
Keyword Arguments
header::Bool
: whether to include the table header.footer::Bool
: whether to include the table footer.id::Union{Nothing,String}
: the id of the HTML table.class::Union{Nothing,String,Vector{String}}
: the class of the HTML table.caption::Union{Nothing,String}
: the caption of the HTML table.editable::Bool
: whether to enable table editing.tooltips::Bool
: whether to include tooltips.js::Union{Nothing,String}
: the JavaScript of the HTML table.css::Union{Nothing,String}
: the CSS of the HTML table.theme::Union{Nothing,Symbol,String}
: the built-in theme of the HTML table.colorscale::Union{Nothing,Symbol,String}
: the colorscale from ColorSchemes.jl for numeric data.
Examples
creates a simple HTML table from a DataFrame and writes it to the standard output:
using HTMLTables, DataFrames
df = DataFrame(x=[1, 2, 3], y=[45, 67, 89])
writetable(stdout, df, styles=false)
<table>
<thead>
<tr>
<td>x</td>
<td>y</td>
</tr>
</thead>
<tbody>
<tr>
<td title="1">1</td>
<td title="45">45</td>
</tr>
<tr>
<td title="2">2</td>
<td title="67">67</td>
</tr>
<tr>
<td title="3">3</td>
<td title="89">89</td>
</tr>
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
creates a simple HTML table from a DataFrame and writes it to a file:
using HTMLTables, DataFrames
df = DataFrame(x=[1, 2, 3], y=[4, 11, 28])
writetable("table.html", df)