Helper class to write html tables to text format.
More...
#include <html_utils.h>
|
| | HtmlTableWriter (int width=120) |
| | constructor initializes the table header More...
|
| |
| template<typename DataT > |
| void | addCell (const DataT &data, std::string header="", std::string bg_color=Colors::white, int colspan=1) |
| | Add a cell to the table. Should be called after beginning a row. Otherwise will throw an exception. More...
|
| |
| void | beginRow () |
| | Begin a new row in the table. More...
|
| |
| void | addHeader (std::string header, std::string text_color=Colors::black, int colspan=1) |
| | Add a table header. Should be called after beginning a row. More...
|
| |
| std::string | getTableString () |
| | Get the html table in string format. More...
|
| |
Helper class to write html tables to text format.
| HtmlTableWriter::HtmlTableWriter |
( |
int |
width = 120 | ) |
|
|
inline |
constructor initializes the table header
- Parameters
-
| width | The width of each column in the table in px |
template<typename DataT >
| void HtmlTableWriter::addCell |
( |
const DataT & |
data, |
|
|
std::string |
header = "", |
|
|
std::string |
bg_color = Colors::white, |
|
|
int |
colspan = 1 |
|
) |
| |
|
inline |
Add a cell to the table. Should be called after beginning a row. Otherwise will throw an exception.
- Template Parameters
-
| DataT | Type of data to add to cell |
- Parameters
-
| data | value of the data to add |
| header | If header is provided it is added along with data to same cell |
| bg_color | Background color of the cell to use (Default white) The color is provided as a hexcode #RGB where R, G, B go from 0 to F |
| colspan | The number of columns to use for the cell |
| void HtmlTableWriter::addHeader |
( |
std::string |
header, |
|
|
std::string |
text_color = Colors::black, |
|
|
int |
colspan = 1 |
|
) |
| |
|
inline |
Add a table header. Should be called after beginning a row.
This is similar to a addCell but is bold and is placed at the top of the table
- Parameters
-
| header | Header value to add. |
| text_color | The color of the text in header. Default is black |
| void HtmlTableWriter::beginRow |
( |
| ) |
|
|
inline |
Begin a new row in the table.
| std::string HtmlTableWriter::getTableString |
( |
| ) |
|
|
inline |
Get the html table in string format.
- Returns
- string of html table
The documentation for this class was generated from the following file: