使用c ++中的haru库在pdf中创建表

时间:2014-01-24 07:50:46

标签: c++ libharu

我需要在C ++中使用Haru库创建Table结构并填充数据。任何人都可以提供使用Haru库创建表结构的示例。

2 个答案:

答案 0 :(得分:2)

I while ago I needed to produce some data tables as part of another project using Haru PDF. To simplify the creation of complex tables I wrote a small utility module to be used with the Haru PDF library that greatly simplifies the creation of complex tables. The module allows full customization of the table and supports for example cell spanning (both row and column). It also allows for the separation of layout and look&fell by a theme concept.

A simple usage example (just to give an idea) would be

 ORDER BY BannerWeight, NEWID()

It is out of scope for this answer to discuss the code in more details but it should be fairly self documenting.

The module also allows both purely programmatic tables but also the creation of entirely data driven table creation (all layout and look & feel is taken from a structure). This allows a light-way model-view-controller approach to make maintenance easier. To fully use this relies on the client implementing callback functions that the module will call to get the corresponding data.

Since this was never intended to be released as a separate utility I haven't written up (yet) full documentation but I put together a quick standalone example which shows some of the features. The resulting PDF from running the example is included at github. However, all public API are fully Doxygen commented which should give some ideas on how it fits together.

You can find the module at (https://github.com/johan162/hpdf_table)

答案 1 :(得分:0)

您可以使用 encoding_list.c 演示中的 draw_graph 功能作为示例。它是源焦油球的一部分。