{oapdf_gg}
Office software is closely linked to the PDF,the PDF is also must have to control!      Set home Page  Add to Favorites  
You are here:Home > PDF Application > PDF Development
PDF Development
Using C# language the whole PDF document Strategy Guide Graphic
Finishing by: Date:2009-04-17 20:59:48 Popularity: Tags:

Chapter V forms

key:If you only generate PDF document (no XML, HTML, RTF ... ...), the use of better pdfPTable instead of type Table.

some simple form

a table is arranged in the cell matrix that contains the rectangular area. Form does not require the matrix is m กม n, and it can have an empty cell or larger than the individual.

Create a form

the most common approach is to pre-aware of a few out a few lines:

public Table (int columns, int rows);

sample code in 0501, we built a simple table:

Table aTable = new Table (2,2);

aTable.addCell ( "0.0 ");

aTable.addCell ( "0.1 ");

aTable.addCell ( "1.0 ");

aTable.addCell ( "1.1 ");

there are two lines of the form 2, the cell was automatically added from the beginning of the first line of the first column, followed by the second column, when his party after the expiry of the next cell automatically added to the next line in the first column.

cells can also be added to the table in the specified location, such as sample code 0502, do not want to add a reference System.Drawing.dll to obtain the Point object, we have created a 4 line 4 and then add some of the form cell to a random position:

Table aTable = new Table (4,4);

aTable.AutoFillEmptyCells = true;

aTable.addCell ( "2.2", new Point (2,2 ));

aTable.addCell ( "3.3", new Point (3,3 ));

aTable.addCell ( "2.1", new Point (2,1 ));

aTable.addCell ( "1.3", new Point (1,3 ));

you can see we will AutoFillEmptyCells property is set to true, this will automatically default the unit to fill the empty cloth Bureau cells, if we have forgotten to do so (as in this case the second form), there would be no add additional cells, does not contain any single cell line will be ignored, in this case, the first will not be displayed, because it is a blank line.

often the result of database query to fill form, in most cases, you do not know in advance how many lines in the end, which is why there is a second reason for the constructor:

public Table (int columns);

iText line is automatically added as needed, in the 0503 sample code, the initialization of the 4 line 4, when we add line 6 and 7 cell line, iText automatically increase the number of rows to 7.

increase in the number of rows is also possible, but a little trouble, it can not automatically generated, you must use methods and set out addColumns wide, see sample code 0504.

there isArticle InformationsComment Information
Category column

Site Help | Site Map | Feedback |
OAPDF.COM Copyright 2009 V1.1