17.05.2014 Views

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

PDFlib 8 Windows COM/.NET Tutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8.3 Table Formatting<br />

The table formatting feature can be used to automatically format complex tables. Table<br />

cells may contain single- or multi-line text, images or PDF graphics. Tables are not restricted<br />

to a single fitbox, but can span multiple pages.<br />

Cookbook Code samples regarding table issues can be found in the tables category of the <strong>PDFlib</strong> Cookbook.<br />

General aspects of a table. The description of the table formatter is based on the following<br />

concepts and terms (see Figure 8.29):<br />

> A table is a virtual object with a rectangular outline. It is comprised of horizontal<br />

rows and vertical columns.<br />

> A simple cell is a rectangular area within a table, defined as the intersection of a row<br />

and a column. A spanning cell spans more than one column, more than one row, or<br />

both. The term cell will be used to designate both simple and spanning cells.<br />

> The complete table may fit into one fitbox, or several fitboxes may be required. The<br />

rows of the table which are placed in one fitbox constitute a table instance. Each call<br />

to fit_table( ) will place one table instance in one fitbox (see Section 8.3.5, »Table Instances«,<br />

page 237).<br />

> The header or footer is a group of one or more rows at the beginning or end of the table<br />

which are repeated at the top or bottom of each table instance. Rows which are<br />

neither part of the header nor footer are called body rows.<br />

Header<br />

Simple cell<br />

Cell containing<br />

Textflow<br />

1 Giant Wing<br />

Material<br />

Benefit<br />

2 Long Distance Glider<br />

Material<br />

Benefit<br />

3 Cone Head Rocket<br />

Our Paper Plane Models<br />

Offset print paper 220g/sqm<br />

It is amazingly robust and<br />

can even do aerobatics. But<br />

it is best suited to gliding.<br />

Drawing paper 180g/sqm<br />

With this paper rocket you<br />

can send all your messages<br />

even when sitting in the<br />

cinema pretty near the back.<br />

Amazingly robust!<br />

Cell spanning<br />

three columns<br />

Cell containing<br />

image and text line<br />

Cell spanning<br />

three rows<br />

Footer<br />

Material<br />

Benefit<br />

Kent paper 200g/sqm<br />

This paper arrow can be<br />

thrown with big swing. It<br />

stays in the air a long time.<br />

With big swing!<br />

Fig. 8.29<br />

Sample table<br />

As an example, all aspects of creating the table in Figure 8.29 will be explained. A complete<br />

description of the table formatting options can be found in the <strong>PDFlib</strong> API<br />

Reference. Creating a table starts by defining the contents and visual properties of each<br />

table cell with add_table_cell( ). Then you place the table using one or more calls to fit_<br />

table( ).<br />

8.3 Table Formatting 227

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!