{
RptReport *ret;
+ GtkStyle *style;
+ PangoFontDescription *pango_font;
+
GList *columns;
GHashTable *columns_names;
RptPoint *point;
RptSize *size;
+ RptFont *font;
+ RptAlign *align;
RptObject *obj;
guint x;
g_return_val_if_fail (GTK_IS_TREE_VIEW (view), NULL);
+ style = gtk_widget_get_style (GTK_WIDGET (view));
+ pango_font = style->font_desc;
+
ret = rpt_report_new ();
columns = gtk_tree_view_get_columns (view);
rpt_report_set_page_margins (ret, 10, 10, 10, 10);
- rpt_report_set_section_height (ret, RPTREPORT_SECTION_PAGE_HEADER, 30);
+ rpt_report_set_section_height (ret, RPTREPORT_SECTION_PAGE_HEADER, 27);
rpt_report_set_page_header_first_last_page (ret, TRUE, TRUE);
- rpt_report_set_section_height (ret, RPTREPORT_SECTION_BODY, 30);
+ rpt_report_set_section_height (ret, RPTREPORT_SECTION_BODY, 15);
if (title != NULL)
{
obj = rpt_obj_text_new ("title", *point);
size = rpt_common_rptsize_new_with_values (page_size->width - 20, 10);
+ font = rpt_common_rptfont_from_pango_description (pango_font);
+ font->size += 2;
+ font->bold = TRUE;
g_object_set (obj,
"source", title,
"size", size,
+ "font", font,
NULL);
g_free (point);
g_free (size);
+ g_free (font);
rpt_report_add_object_to_section (ret, obj, RPTREPORT_SECTION_PAGE_HEADER);
}
col = (GtkTreeViewColumn *)columns->data;
col_title = g_strdup_printf ("\"%s\"", gtk_tree_view_column_get_title (col));
- col_width = gtk_tree_view_column_get_width (col) / 96 * 25.4;
+ col_width = rpt_common_points_to_value (RPT_UNIT_MILLIMETRE, gtk_tree_view_column_get_width (col) / 96 * 72);
- point = rpt_common_rptpoint_new_with_values (x, 20);
+ point = rpt_common_rptpoint_new_with_values (x, 15);
size = rpt_common_rptsize_new_with_values (col_width, 10);
+ font = rpt_common_rptfont_from_pango_description (pango_font);
+ font->bold = TRUE;
obj = rpt_obj_text_new (g_strdup_printf ("title_%d", idx), *point);
g_object_set (obj,
"source", col_title,
"size", size,
+ "font", font,
NULL);
rpt_report_add_object_to_section (ret, obj, RPTREPORT_SECTION_PAGE_HEADER);
+ g_free (point);
+ g_free (font);
+
+ point = rpt_common_rptpoint_new_with_values (x, 0);
+ font = rpt_common_rptfont_from_pango_description (pango_font);
+
field_name = g_strdup_printf ("field_%d", idx);
obj = rpt_obj_text_new (field_name, *point);
g_object_set (obj,
"source", g_strdup_printf ("[%s]", field_name),
"size", size,
+ "font", font,
NULL);
rpt_report_add_object_to_section (ret, obj, RPTREPORT_SECTION_BODY);
g_free (point);
g_free (size);
+ g_free (font);
g_hash_table_insert (columns_names, field_name, g_strdup_printf ("%d", idx));
columns = g_list_next (columns);
}
- point = rpt_common_rptpoint_new_with_values (0, 10);
+ point = rpt_common_rptpoint_new_with_values (0, 25);
obj = rpt_obj_line_new ("line1", *point);
size = rpt_common_rptsize_new_with_values (page_size->width - 20, 0);
rpt_report_add_object_to_section (ret, obj, RPTREPORT_SECTION_PAGE_HEADER);
- rpt_report_set_section_height (ret, RPTREPORT_SECTION_PAGE_FOOTER, 15);
+ rpt_report_set_section_height (ret, RPTREPORT_SECTION_PAGE_FOOTER, 12);
point = rpt_common_rptpoint_new_with_values (0, 0);
obj = rpt_obj_line_new ("line2", *point);
rpt_report_add_object_to_section (ret, obj, RPTREPORT_SECTION_PAGE_FOOTER);
rpt_report_set_page_footer_first_last_page (ret, TRUE, TRUE);
- point = rpt_common_rptpoint_new_with_values (0, 0);
+ point = rpt_common_rptpoint_new_with_values (0, 2);
obj = rpt_obj_text_new ("pages", *point);
size = rpt_common_rptsize_new_with_values (page_size->width - 20, 10);
+ align = rpt_common_rptalign_new ();
+ align->h_align = RPT_HALIGN_RIGHT;
+ font = rpt_common_rptfont_from_pango_description (pango_font);
+ font->size -= 1;
g_object_set (obj,
"source", "\"Page \" & @Page & \" of \" & @Pages",
"size", size,
+ "font", font,
+ "align", align,
NULL);
g_free (point);
g_free (size);
+ g_free (font);
rpt_report_add_object_to_section (ret, obj, RPTREPORT_SECTION_PAGE_FOOTER);
<?xml version="1.0"?>
<reptool>
<properties>
- <unit-length>pt</unit-length>
- <output-type>png</output-type>
- <output-filename>test.png</output-filename>
+ <unit-length>mm</unit-length>
+ <output-type>pdf</output-type>
+ <output-filename>rptreport.pdf</output-filename>
<copies>1</copies>
</properties>
<database>
<connection-string/>
<sql/>
</database>
- <page width="595.000000" height="842.000000"/>
+ <page width="297,000000" height="210,000000" margin-top="10,000000" margin-right="10,000000" margin-bottom="10,000000" margin-left="10,000000"/>
<report>
- <report-header height="80.000000">
- <text name="rephead" x="10.000000" y="10.000000" width="300.000000" height="70.000000" font-name="Verdana" font-size="16.000000" font-bold="y" font-color="#0000FFFF" source=""the report's header""/>
- </report-header>
- <page-header first-page="y" height="80.000000">
- <text name="title" x="10.000000" y="10.000000" width="300.000000" height="50.000000" font-name="Courier New" font-size="10.000000" font-bold="y" source=""the page's title" & " - " & @Page"/>
- <line name="line1" x="10.000000" y="65.000000" width="500.000000" height="0.000000" stroke-width="1.000000" stroke-color="#000000FF"/>
+ <page-header first-page="y" last-page="y" height="27,000000">
+ <text name="title" x="0,000000" y="0,000000" width="277,000000" height="10,000000" font-name="Droid Sans" font-size="11,000000" font-bold="y" font-color="#000000FF" source=""Report's Title""/>
+ <text name="title_0" x="0,000000" y="15,000000" width="50,000000" height="10,000000" font-name="Droid Sans" font-size="9,000000" font-bold="y" font-color="#000000FF" source=""Book's title""/>
+ <text name="title_1" x="55,000000" y="15,000000" width="76,000000" height="10,000000" font-name="Droid Sans" font-size="9,000000" font-bold="y" font-color="#000000FF" source=""Author""/>
+ <line name="line1" x="0,000000" y="25,000000" width="277,000000" height="0,000000"/>
</page-header>
- <body height="200.000000">
- <text name="txt_id" x="50.000000" y="50.000000" width="100.000000" height="50.000000" border-top-width="1.000000" border-top-color="#FF0000FF" font-name="Sans" font-size="12.000000" source="[id]"/>
- <text name="txt_name" x="200.000000" y="50.000000" width="100.000000" height="50.000000" font-name="Sans" font-size="12.000000" source="[name]"/>
- <text name="txt_req" x="50.000000" y="100.000000" width="100.000000" height="50.000000" font-name="Sans" font-size="12.000000" source="[nonexistent]"/>
- <rect name="rect1" x="400.000000" y="10.000000" width="20.000000" height="20.000000" stroke-width="1.000000" stroke-color="#000000FF" fill-color="#00FF00FF"/>
- <image name="img1" x="450.000000" y="10.000000" width="60.000000" height="60.000000" border-bottom-width="1.000000" border-bottom-color="#FF0000FF" border-bottom-style="10.000000;10.000000;" source="tests/gnome-globe.png"/>
+ <body height="15,000000">
+ <text name="field_0" x="0,000000" y="0,000000" width="50,000000" height="10,000000" font-name="Droid Sans" font-size="9,000000" font-color="#000000FF" source="[field_0]"/>
+ <text name="field_1" x="55,000000" y="0,000000" width="76,000000" height="10,000000" font-name="Droid Sans" font-size="9,000000" font-color="#000000FF" source="[field_1]"/>
</body>
- <report-footer height="50.000000">
- <line name="line3" x="10.000000" y="10.000000" width="500.000000" height="0.000000" stroke-width="1.000000" stroke-color="#FFFF00FF" stroke-style="50.000000;10.000000;"/>
- <text name="txt_report_footer" x="10.000000" y="20.000000" width="500.000000" height="30.000000" font-name="Sans" font-size="12.000000" horizontal-align="center" source=""the report's footer""/>
- <line name="line4" x="10.000000" y="50.000000" width="500.000000" height="0.000000" stroke-width="1.000000" stroke-color="#FFFF00FF" stroke-style="1.000000;5.000000;"/>
- </report-footer>
- <page-footer first-page="y" last-page="y" height="80.000000">
- <line name="line2" x="10.000000" y="10.000000" width="500.000000" height="0.000000" stroke-width="1.000000" stroke-color="#000000FF"/>
- <text name="footer" x="10.000000" y="20.000000" width="300.000000" height="50.000000" font-name="Sans" font-size="12.000000" source=""the page's footer""/>
- <ellipse name="ellipse1" x="400.000000" y="50.000000" width="20.000000" height="10.000000" stroke-width="1.000000" stroke-color="#FF0000FF" fill-color="#00FF00FF"/>
- <text name="page_n" x="500.000000" y="20.000000" width="50.000000" height="50.000000" font-name="Sans" font-size="12.000000" source="@Page & "/" & @Pages"/>
+ <page-footer first-page="y" last-page="y" height="12,000000">
+ <line name="line2" x="0,000000" y="0,000000" width="277,000000" height="0,000000"/>
+ <text name="pages" x="0,000000" y="2,000000" width="277,000000" height="10,000000" font-name="Droid Sans" font-size="8,000000" font-color="#000000FF" horizontal-align="right" source=""Page " & @Page & " of " & @Pages"/>
</page-footer>
</report>
</reptool>