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.3 Table and Column Widths<br />

When adding a cell to the table, you define the number of columns and/or rows<br />

spanned by the cell with the colspan and rowspan options. By default, a cell spans one<br />

column and one row. The total number of columns and rows in the table is implicitly increased<br />

by the respective values when adding a cell. Figure 8.33 shows an example of a<br />

table containing three columns and four rows.<br />

row 1<br />

row 2<br />

row 3<br />

row 4<br />

1 1<br />

1 2<br />

1 3<br />

1 4<br />

cell ............ spanning ............ three ............ columns<br />

cell ...... spanning ...... two ...... columns<br />

simple cell<br />

simple cell<br />

2 3<br />

2 4<br />

simple cell<br />

simple cell<br />

3 2<br />

cell ....<br />

.... spanning ....<br />

.... three rows<br />

Fig. 8.33<br />

Simple cells and cells spanning<br />

several rows or columns<br />

column 1 column 2 column 3<br />

Furthermore you can explicitly supply the width of the first column spanned by the cell<br />

with the colwidth option. By supplying each cell with a defined first column width all<br />

those width values will implicitly add up to the total table width. Figure 8.34 shows an<br />

example.<br />

1<br />

1<br />

1<br />

1<br />

1<br />

2<br />

3<br />

colspan=3<br />

colwidth=50<br />

colspan=2<br />

colwidth=50<br />

colspan=1<br />

colwidth=50<br />

colspan=1<br />

colwidth=50<br />

4<br />

2<br />

2<br />

3<br />

4<br />

colspan=1<br />

colwidth=100<br />

colspan=1<br />

colwidth=100<br />

3<br />

2<br />

rowspan=3<br />

colwidth=90<br />

Fig. 8.34<br />

Column widths define<br />

the total table width.<br />

50 100 90<br />

total table width of 240<br />

Alternatively, you can specify the column widths as percentages if appropriate. In this<br />

case the percentages refer to the width of the table’s fitbox. Either none or all column<br />

widths must be supplied as percentages.<br />

If some columns are combined to a column scaling group with the colscalegroup option<br />

of add_table_cell( ), their widths will be adjusted to the widest column in the group<br />

(see Figure 8.35),<br />

column scaling group<br />

Max. Load<br />

Range<br />

Weight<br />

Speed<br />

Fig. 8.35<br />

The last four cells in the first row are in the<br />

same column scaling group. They will have<br />

the same widths.<br />

Giant Wing<br />

12g<br />

18m<br />

14g<br />

8m/s<br />

Long Distance Glider<br />

5g<br />

30m<br />

11.2g<br />

5m/s<br />

Cone Head Rocket<br />

7g<br />

7m<br />

12.4g<br />

6m/s<br />

If absolute coordinates are used (as opposed to percentages) and there are cells left<br />

without any column width defined, the missing widths are calculated as follows: First,<br />

8.3 Table Formatting 233

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

Saved successfully!

Ooh no, something went wrong!