Defining a table with a data structure for table and cells.
#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
static char *
cb_content(void *tag, size_t r, size_t c) {
static char *cell_content[] =
{"Mark Ericsen",
"12 Sep 2021",
"123 Downer Mews",
"London",
"NW2 HB3",
"mark.p.ericsen@myfinemail.com",
"+44734 354 184 56",
"+44771 938 137 11"};
if( 0==r && 0==c) return cell_content[0];
else if (0==r && 3==c) return cell_content[1];
else if (1==r && 0==c) return cell_content[2];
else if (2==r && 0==c) return cell_content[3];
else if (2==r && 3==c) return cell_content[4];
else if (3==r && 0==c) return cell_content[5];
else if (4==r && 0==c) return cell_content[6];
else if (4==r && 2==c) return cell_content[7];
else return NULL;
}
#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif
{.
row=0, .col=0, .rowspan=1, .colspan=3,
.label="Name:",
.content_cb=NULL, .label_cb=NULL, .style_cb=NULL, .canvas_cb=NULL},
{.row=0, .col=3, .rowspan=1, .colspan=1,
.label="Date:",
.content_cb=NULL, .label_cb=NULL, .style_cb=NULL, .canvas_cb=NULL},
{.row=1, .col=0, .rowspan=1, .colspan=4,
.label="Address:",
.content_cb=NULL, .label_cb=NULL, .style_cb=NULL, .canvas_cb=NULL},
{.row=2, .col=0, .rowspan=1, .colspan=3,
.label="City:",
.content_cb=NULL, .label_cb=NULL, .style_cb=NULL, .canvas_cb=NULL},
{.row=2, .col=3, .rowspan=1, .colspan=1,
.label="Zip:",
.content_cb=NULL, .label_cb=NULL, .style_cb=NULL, .canvas_cb=NULL},
{.row=3, .col=0, .rowspan=1, .colspan=4,
.label="E-mail:",
.content_cb=NULL, .label_cb=NULL, .style_cb=NULL, .canvas_cb=NULL},
{.row=4, .col=0, .rowspan=1, .colspan=2,
.label="Work-phone:",
.content_cb=NULL, .label_cb=NULL, .style_cb=NULL, .canvas_cb=NULL},
{.row=4, .col=2, .rowspan=1, .colspan=2,
.label="Mobile:",
.content_cb=NULL, .label_cb=NULL, .style_cb=NULL, .canvas_cb=NULL},
};
.rows=5, .cols=4,
.content_cb=cb_content, .label_cb=0,
.style_cb=NULL, .post_cb=NULL,
.cell_spec=cell_specs
};
void
create_table_ex13_2(HPDF_Doc pdf_doc, HPDF_Page pdf_page) {
}
int hpdftbl_stroke_from_data(HPDF_Doc pdf_doc, HPDF_Page pdf_page, hpdftbl_spec_t *tbl_spec, hpdftbl_theme_t *theme)
Construct the table from a array specification.
Definition: hpdftbl.c:1265
#define TRUE
Boolean truth value.
Definition: hpdftbl.h:47
#define FALSE
Boolean false value.
Definition: hpdftbl.h:52
#define A4PAGE_HEIGHT_CM
Standard A4 paper height in cm.
Definition: hpdftbl.h:198
#define hpdftbl_cm2dpi(c)
Convert cm to dots using the default resolution (72 DPI)
Definition: hpdftbl.h:256
#define HPDFTBL_END_CELLSPECS
Sentinel to mark the end of Cell Specifications for data driven table definition.
Definition: hpdftbl.h:238
Used in data driven table creation.
Definition: hpdftbl.h:569
size_t row
Definition: hpdftbl.h:571
Used in data driven table creation.
Definition: hpdftbl.h:596
char * title
Definition: hpdftbl.h:598
Common functions for all unit-test/examples.
#define TUTEX_MAIN(_tbl_, _showgrid_)
Macro to create a main() function to call the table creation function for each example....
Definition: unit_test.inc.h:322