{oapdf_gg}
some form parameterstable in front of the example is not beautiful, we can set up a large number of parameters to change the appearance of form. Table and Cell-type-type derived from type Rectangle, we can use a large number of typical Rectangle method, let us take a look at the sample code 0505. Table table = new Table (3); table.BorderWidth = 1; table.BorderColor = new Color (0, 0, 255); table.Cellpadding = 5; 5. table.Cellspacing = 5; Cell cell = new Cell ( "header "); cell.Header = true; cell.Colspan = 3; table.addCell (cell); 10. cell = new Cell ( "example cell with colspan 1 and rowspan 2 "); cell.Rowspan = 2; cell.BorderColor = new Color (255, 0, 0); table.addCell (cell); table.addCell ( "1.1 "); 15. table.addCell ( "2.1 "); table.addCell ( "1.2 "); table.addCell ( "2.2 "); table.addCell ( "cell test1 "); cell = new Cell ( "big cell "); 20. cell.Rowspan = 2; cell.Colspan = 2; cell.BackgroundColor = new Color (0xC0, 0xC0, 0xC0); table.addCell (cell); table.addCell ( "cell test2 "); 25. document.Add (table);
u cell spacing and filling from the line in section 4, we set up a form from the filling, that is, the contents of the cell boundaries and a certain amount of space between, in the previous example, we can see the text close to the border, through the use of fill from the use of specific , could be avoided. line in section 5, we set up a table space, that is, the border cells and form a certain amount of space between different cells use the half space, the specific code, see sample code 0506. u alignment sample code in 0506, we also changed the cell "big cell" of the alignment: cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; Note:You can not always believe that the vertical alignment. u border If we as in the first 14 lines were added as a single cell, the unit will use the default grid Authority (the default method of the layout can be changed SetDefalut), if we use the Cell object, we can control each cell layout. in section 2 and third, we set the whole table border width and border color, we can use the cell method, in 12 lines, each cell with "box" as the border drawn (in the case of as in the HTML), but the 0507 sample code shows that we have a large number of PDF more likely. u color line in section 22, you can also define the background color of cells in the sample code in 0507, we do not use color to fill only a certain gray. u cross-listed firms and cross- Finally, you can also set up an inter-cell lines (11/20 lines) and cross-out (8/21). In this way a few cells can be merged into one large cell. u Note No. 7 line in PDF meaningless, used to generate HTML, the HTML in the not always produce the same layout, PDF forms are a bit like:
u partition table If a table can not beon page will automatically be divided sample code shows that when 0508 arrived at a table when the marginal situation, which will explain in the next section. |