#include <hk_reportutils.h>
Inheritance diagram for hk_reportcsv:


Public Member Functions | |
| void | set_groupcolumn (const hk_string &c) |
| void | set_multiplefiles (bool m=true) |
| void | set_filedefinition (const hk_string &textdelimiter="\"", const hk_string &betweenfields=",", const hk_string &rowdelimiter="\n", const hk_string &datetimeformat="", const hk_string &dateformat="", const hk_string &timeformat="", const hk_string &charset="", const hk_string &locale="") |
| void | set_withheader (bool with) |
| hk_string | textdelimiter (void) |
| hk_string | between (void) |
Protected Member Functions | |
| void | configure_page (void) |
| virtual void | widget_specific_before_execute (void) |
| virtual void | widget_specific_after_execute (void) |
Protected Attributes | |
| hk_reportsection * | p_datasection |
| hk_reportsection * | p_footsection |
CVS is a standard exportformat. Usually it is a comma separated list with on datarow per line. The data is usually delimited by "". The first line may contain the columnnames. Normally you just have to set the datasource and then execute the report.
Example
// first create a datasource
hk_classes p_class;
hk_connection* connect=p_class.hk_create("mysql");
connect->user("root");
connect->host("localhost");
connect->password("my_password");
connect->connect();
hk_database* database=connect->new_database();
database->name("vokabeltrainer");
hk_datasource* datasource=database->new_resultquery();
datasource->sql("SELECT * FROM vokabeln");
// now create the output as a CVS document
hk_reportcsv e; e.datasource(datasource); e.execute(); *
| void hk_reportcsv::set_filedefinition | ( | const hk_string & | textdelimiter = "\"", |
|
| const hk_string & | betweenfields = ",", |
|||
| const hk_string & | rowdelimiter = "\n", |
|||
| const hk_string & | datetimeformat = "", |
|||
| const hk_string & | dateformat = "", |
|||
| const hk_string & | timeformat = "", |
|||
| const hk_string & | charset = "", |
|||
| const hk_string & | locale = "" | |||
| ) |
Here you can easily define other delimiters and data separators.To get a tabulatorseparated list just set set_dataformat("\"","");
| void hk_reportcsv::set_withheader | ( | bool | with | ) |
set it to false if you don't want the columnnames in the first line (default ist true)
1.5.0