10.07.2015 Views

Download - Multivac!

Download - Multivac!

Download - Multivac!

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

oldfont = p.load_font("Helvetica-Bold", "unicode", "");normalfont = p.load_font("Helvetica", "unicode", "");p.begin_page_ext(0, 0, "width=a4.width height=a4.height");Step 1: Adding the first cell. We start with the first cell of our table. The cell will beplaced in the first column of the first row and will span three columns. The first columnhas a width of 50 points. The text line is centered vertically and horizontally, with amargin of 4 points from all borders. The following code fragment shows how to add thefirst cell:optlist = "fittextline={font=" + boldfont + " fontsize=12 position=center} " +"margin=4 colspan=3 colwidth=" + c1;tbl = p.add_table_cell(tbl, 1, 1, "Our Paper Plane Models", optlist);if (tbl == -1)throw new Exception("Error: " + p.get_errmsg());Step 2: Adding one cell spanning two columns. In the next step we add the cell containingthe text line 1 Giant Wing. It will be placed in the first column of the second rowand spans two columns. The first column has a width of 50 points. The row height is 14points. The text line is positioned on the top left, with a margin of 4 points from all borders.We use fontsize={capheight=6} to get a unique vertical text alignment as describedin »Fine-tuning the vertical alignment of cell contents«, page 166.Since the Giant Wing heading cell doesn’t cover a complete row but only two of threecolumns it cannot be filled with color using on of the row-based shading options. Weapply the Matchbox feature instead to fill the rectangle covered by the cell with a graybackground color. (The Matchbox feature is discussed in detail in Section 7.5, »Matchboxes«,page 177.) The following code fragment demonstrates how to add the Giant Wingheading cell:optlist = "fittextline={position={left top} font=" + boldfont +" fontsize={capheight=6}} rowheight=14 colwidth=" + c1 +" margin=4 colspan=2 matchbox={fillcolor={gray .92}}";tbl = p.add_table_cell(tbl, 1, 2, "1 Giant Wing", optlist);if (tbl == -1)throw new Exception("Error: " + p.get_errmsg());Fig. 7.41 Adding table cells with various contents step by stepGenerated tableOur Paper Plane Models1 Giant WingMaterial Offset print paper 220g/sqmBenefit It is amazingly robust and caneven do aerobatics. But it isbest suited to gliding.Amazingly robust!Generation stepsStep 1: Add a cell spanning 3 columnsStep 2: Add a cell spanning 2 columnsStep 3: Add 3 more text line cellsStep 4: Add the Textflow cellStep 5: Add the image cell with a text lineStep 6: Fitting the tableStep 3: Add three more text line cells. The following code fragment adds the Material,Benefit and Offset print paper... cells. The Offset print paper... cell will start in the second7.4 Table Formatting 171

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

Saved successfully!

Ooh no, something went wrong!