| Examples | Description | 
|---|---|
| Example 1 | The following example shows you how to build a simple table. | 
| Example 2 | The following example shows you how to build a simple table. | 
| Example 3 | The following example shows you how to build a simple table. | 
| Example 4 | The following example shows you how to build a simple table. | 
| Example 5 | The following example shows you how to build a simple table. | 
| Example 6 | The following example shows you how to build a simple table. | 
| Example 7 | The following example shows you how to build a simple table. | 
| Example 8 | The following example shows you how to build a simple table. | 
| Example 9 | The following example shows you how to build a simple table. | 
| Example 10 | The following example shows you how to build a simple table. | 
| Example 11 | The following example shows you how to build a simple table. | 
Example 1: The following example will display a simple table on the page.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.Cell2;
import com.cete.dynamicpdf.pageelements.Column2;
import com.cete.dynamicpdf.pageelements.Row2;
import com.cete.dynamicpdf.pageelements.Table2;
  
 public class MyClass{
       public static void main(String args[]){
       
          // Create a PDF Document
          Document document = new Document();
        
          // Create a Page and add it to the document
          Page page = new Page();
          document.getPages().add( page );
        
          // Create a table
          Table2 table = new Table2(0, 0, 600, 600);
        
          table.getCellDefault().setAlign(TextAlign.CENTER);
          table.getCellDefault().setVAlign(VAlign.CENTER);
          table.getBorder().setLineStyle(LineStyle.getSolid());
          table.setCellSpacing(5.0f);
        
          // Add columns to the table
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
        
          // Add rows to the table and add cells to the rows
          Row2 row1 = table.getRows().add( 0, Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey());
          row1.getCells().add( "Header 1" );
          row1.getCells().add( "Header 2" );
          row1.getCells().add( "Header 3" );
        
          Row2 row2 = table.getRows().add();
          Cell2 cell1 = row2.getCells().add( "Rowheader 1", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
          row2.getCells().add( "Item 1" );
          row2.getCells().add( "Item 2" );
        
          Row2 row3 = table.getRows().add();
          Cell2 cell2 = row3.getCells().add( "Rowheader 2", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
          row3.getCells().add( "Item 3" );
          row3.getCells().add( "Item 4" );
        
          Row2 row4 = table.getRows().add();
          row4.getCells().add( "Rowheader 3", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey(), 1 );
          row4.getCells().add( "Item 5" );
          row4.getCells().add( "Item 6" );
        
          // Add the table to the page
          page.getElements().add( table );
 
          // Save the PDF
          document.draw("[PhysicalPath]/MyDocument.pdf");
       }
 }   Top 
Example 2:The following example shows you how to build a simple table.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.Cell2;
import com.cete.dynamicpdf.pageelements.Column2;
import com.cete.dynamicpdf.pageelements.Row2;
import com.cete.dynamicpdf.pageelements.Table2;
public class MyClass
{
    public static void Main(String args[])
    {
          // Create a PDF Document
          Document document = new Document();
        
          // Create a Page and add it to the document
          Page page = new Page();
          document.getPages().add( page );
        
          // Create a table
          Table2 table = new Table2(0, 0, 600, 600);
        
          table.getCellDefault().setAlign(TextAlign.CENTER);
          table.getCellDefault().setVAlign(VAlign.CENTER);
          table.getBorder().setLineStyle(LineStyle.getSolid());
          table.setCellSpacing(5.0f);
        
          // Add columns to the table
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
        
          // Add rows to the table and add cells to the rows
          Row2 row1 = table.getRows().add( 0, Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey());
          row1.getCells().add( "Header 1" );
          row1.getCells().add( "Header 2" );
          row1.getCells().add( "Header 3" );
        
          Row2 row2 = table.getRows().add();
          Cell2 cell1 = row2.getCells().add( "Rowheader 1", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
          row2.getCells().add( "Item 1" );
          row2.getCells().add( "Item 2" );
        
          Row2 row3 = table.getRows().add();
          Cell2 cell2 = row3.getCells().add( "Rowheader 2", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
          row3.getCells().add( "Item 3" );
          row3.getCells().add( "Item 4" );
        
          Row2 row4 = table.getRows().add();
          row4.getCells().add( "Rowheader 3", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey(), 1 );
          row4.getCells().add( "Item 5",2 );
          // Add the table to the page
          page.getElements().add( table );
    
          // Save the PDF
          document.draw("[Physicalpath/MyDocument.pdf");
    }
}  Top 
 Example 3: The following example shows you how to build a simple table.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.Cell2;
import com.cete.dynamicpdf.pageelements.Column2;
import com.cete.dynamicpdf.pageelements.Row2;
import com.cete.dynamicpdf.pageelements.Table2;
public class MyClass
{
    public static void Main(String args[])
    {
          // Create a PDF Document
          Document document = new Document();
        
          // Create a Page and add it to the document
          Page page = new Page();
          document.getPages().add( page );
        
          // Create a table
          Table2 table = new Table2(0, 0, 600, 600);
        
          table.getCellDefault().setAlign(TextAlign.CENTER);
          table.getCellDefault().setVAlign(VAlign.CENTER);
          table.getBorder().setLineStyle(LineStyle.getSolid());
          table.setCellSpacing(5.0f);
        
          // Add columns to the table
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
        
          // Add rows to the table and add cells to the rows
          Row2 row1 = table.getRows().add( 0, Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey());
          row1.getCells().add( "Header 1" );
          row1.getCells().add( "Header 2" );
          row1.getCells().add( "Header 3" );
        
          Row2 row2 = table.getRows().add();
          Cell2 cell1 = row2.getCells().add( "Rowheader 1", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
          row2.getCells().add( "Item 1" );
          row2.getCells().add( "Item 2" );
        
          Row2 row3 = table.getRows().add();
          Cell2 cell2 = row3.getCells().add( "Rowheader 2", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
          row3.getCells().add( "Item 3" );
          row3.getCells().add( "Item 4" );
        
          Row2 row4 = table.getRows().add();
          row4.getCells().add( "Rowheader 3", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey(), 1 );
          row4.getCells().add( "Item 5", Font.getCourier(), 10 );
          row4.getCells().add( "Item 6", Font.getCourier(), 10 );
          // Add the table to the page
          page.getElements().add( table );
    
         // Save the PDF
         document.draw("[Physicalpath/MyDocument.pdf");
    }
}  Top 
 Example 4: The following example shows you how to build a simple table.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.Cell2;
import com.cete.dynamicpdf.pageelements.Column2;
import com.cete.dynamicpdf.pageelements.Row2;
import com.cete.dynamicpdf.pageelements.Table2;
public class MyClass
{
    public static void Main(String args[])
    {
          // Create a PDF Document
          Document document = new Document();
        
          // Create a Page and add it to the document
          Page page = new Page();
          document.getPages().add( page );
        
          // Create a table
          Table2 table = new Table2(0, 0, 600, 600);
        
          table.getCellDefault().setAlign(TextAlign.CENTER);
          table.getCellDefault().setVAlign(VAlign.CENTER);
          table.getBorder().setLineStyle(LineStyle.getSolid());
          table.setCellSpacing(5.0f);
        
          // Add columns to the table
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
        
          // Add rows to the table and add cells to the rows
          Row2 row1 = table.getRows().add( 0, Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey());
          row1.getCells().add( "Header 1" );
          row1.getCells().add( "Header 2" );
          row1.getCells().add( "Header 3" );
        
          Row2 row2 = table.getRows().add();
          Cell2 cell1 = row2.getCells().add( "Rowheader 1", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
	  row2.getCells().add( "Item 1", Font.getHelveticaOblique(), 14, 2 );
        
          Row2 row3 = table.getRows().add();
          Cell2 cell2 = row3.getCells().add( "Rowheader 2", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
          row3.getCells().add( "Item 2" );
          row3.getCells().add( "Item 3" );
        
          Row2 row4 = table.getRows().add();
          row4.getCells().add( "Rowheader 3", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey(), 1 );
          row4.getCells().add( "Item 4");
          row4.getCells().add( "Item 5");
          // Add the table to the page
          page.getElements().add( table );
    
          // Save the PDF
          document.draw("[Physicalpath/MyDocument.pdf");
    }
}  Top 
Example 5: The following example shows you how to build a simple table.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.Cell2;
import com.cete.dynamicpdf.pageelements.Column2;
import com.cete.dynamicpdf.pageelements.Row2;
import com.cete.dynamicpdf.pageelements.Table2;
public class MyClass
{
    public static void Main(String args[])
    {
          // Create a PDF Document
          Document document = new Document();
        
          // Create a Page and add it to the document
          Page page = new Page();
          document.getPages().add( page );
        
          // Create a table
          Table2 table = new Table2(0, 0, 600, 600);
        
          table.getCellDefault().setAlign(TextAlign.CENTER);
          table.getCellDefault().setVAlign(VAlign.CENTER);
          table.getBorder().setLineStyle(LineStyle.getSolid());
          table.setCellSpacing(5.0f);
        
          // Add columns to the table
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
        
          // Add rows to the table and add cells to the rows
          Row2 row1 = table.getRows().add( 0, Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey());
          row1.getCells().add( "Header 1" );
          row1.getCells().add( "Header 2" );
          row1.getCells().add( "Header 3" );
        
          Row2 row2 = table.getRows().add();
          Cell2 cell1 = row2.getCells().add( "Rowheader 1", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
	  row2.getCells().add( "Item 1", Font.getSymbol(), 20, 2,2 );
        
          Row2 row3 = table.getRows().add();
          Cell2 cell2 = row3.getCells().add( "Rowheader 2", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
        
          Row2 row4 = table.getRows().add();
          row4.getCells().add( "Rowheader 3", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey(), 1 );
          row4.getCells().add( "Item 2");
          row4.getCells().add( "Item 3");
          // Add the table to the page
          page.getElements().add( table );
    
          // Save the PDF
          document.draw("[Physicalpath/MyDocument.pdf");
    }
}  Top 
 Example 6: The following example shows you how to build a simple table.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.Cell2;
import com.cete.dynamicpdf.pageelements.Column2;
import com.cete.dynamicpdf.pageelements.Row2;
import com.cete.dynamicpdf.pageelements.Table2;
public class MyClass
{
    public static void Main(String args[])
    {
          // Create a PDF Document
          Document document = new Document();
        
          // Create a Page and add it to the document
          Page page = new Page();
          document.getPages().add( page );
        
          // Create a table
          Table2 table = new Table2(0, 0, 600, 600);
        
          table.getCellDefault().setAlign(TextAlign.CENTER);
          table.getCellDefault().setVAlign(VAlign.CENTER);
          table.getBorder().setLineStyle(LineStyle.getSolid());
          table.setCellSpacing(5.0f);
        
          // Add columns to the table
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
        
          // Add rows to the table and add cells to the rows
          Row2 row1 = table.getRows().add( 0, Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey());
          row1.getCells().add( "Header 1" );
          row1.getCells().add( "Header 2" );
          row1.getCells().add( "Header 3" );
        
          Row2 row2 = table.getRows().add();
          Cell2 cell1 = row2.getCells().add( "Rowheader 1", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
	  row2.getCells().add( "Item 1", 2,2 );
        
          Row2 row3 = table.getRows().add();
          Cell2 cell2 = row3.getCells().add( "Rowheader 2", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
        
          Row2 row4 = table.getRows().add();
          row4.getCells().add( "Rowheader 3", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey(), 1 );
          row4.getCells().add( "Item 2");
          row4.getCells().add( "Item 3");
          // Add the table to the page
          page.getElements().add( table );
    
          // Save the PDF
          document.draw("[Physicalpath/MyDocument.pdf");
    }
}  Top 
 Example 7: The following example shows you how to build a simple table.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.Cell2;
import com.cete.dynamicpdf.pageelements.Column2;
import com.cete.dynamicpdf.pageelements.Row2;
import com.cete.dynamicpdf.pageelements.Table2;
public class MyClass
{
    public static void Main(String args[])
    {
          // Create a PDF Document
          Document document = new Document();
        
          // Create a Page and add it to the document
          Page page = new Page();
          document.getPages().add( page );
        
          // Create a table
          Table2 table = new Table2(0, 0, 600, 600);
        
          table.getCellDefault().setAlign(TextAlign.CENTER);
          table.getCellDefault().setVAlign(VAlign.CENTER);
          table.getBorder().setLineStyle(LineStyle.getSolid());
          table.setCellSpacing(5.0f);
        
          // Add columns to the table
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
        
          // Add rows to the table and add cells to the rows
          Row2 row1 = table.getRows().add( 0, Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey());
          row1.getCells().add( "Header 1" );
          row1.getCells().add( "Header 2" );
          row1.getCells().add( "Header 3" );
        
          Row2 row2 = table.getRows().add();
          Cell2 cell1 = row2.getCells().add( "Rowheader 1", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
          row2.getCells().add( "Item 1", Font.getHelveticaOblique(), 14, RgbColor.getBlue(),
                RgbColor.getYellow(), 2 );
        
          Row2 row3 = table.getRows().add();
          Cell2 cell2 = row3.getCells().add( "Rowheader 2", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
          row3.getCells().add( "Item 2" );
          row3.getCells().add( "Item 3" );
        
          Row2 row4 = table.getRows().add();
          row4.getCells().add( "Rowheader 3", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey(), 1 );
          row4.getCells().add( "Item 4");
          row4.getCells().add( "Item 5");
          // Add the table to the page
          page.getElements().add( table );
    
          // Save the PDF
          document.draw("[Physicalpath/MyDocument.pdf");
    }
}  Top 
 Example 8: The following example shows you how to build a simple table.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.Cell2;
import com.cete.dynamicpdf.pageelements.Column2;
import com.cete.dynamicpdf.pageelements.Row2;
import com.cete.dynamicpdf.pageelements.Table2;
public class MyClass
{
    public static void Main(String args[])
    {
          // Create a PDF Document
          Document document = new Document();
        
          // Create a Page and add it to the document
          Page page = new Page();
          document.getPages().add( page );
        
          // Create a table
          Table2 table = new Table2(0, 0, 600, 600);
        
          table.getCellDefault().setAlign(TextAlign.CENTER);
          table.getCellDefault().setVAlign(VAlign.CENTER);
          table.getBorder().setLineStyle(LineStyle.getSolid());
          table.setCellSpacing(5.0f);
        
          // Add columns to the table
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
        
          // Add rows to the table and add cells to the rows
          Row2 row1 = table.getRows().add( 0, Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey());
          row1.getCells().add( "Header 1" );
          row1.getCells().add( "Header 2" );
          row1.getCells().add( "Header 3" );
        
          Row2 row2 = table.getRows().add();
          Cell2 cell1 = row2.getCells().add( "Rowheader 1", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
	  row2.getCells().add( "Item 1", Font.getHelveticaOblique(), 14, RgbColor.getRed(),
                RgbColor.getLightSkyBlue(), 2, 2 );
        
          Row2 row3 = table.getRows().add();
          Cell2 cell2 = row3.getCells().add( "Rowheader 2", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
        
          Row2 row4 = table.getRows().add();
          row4.getCells().add( "Rowheader 3", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey(), 1 );
          row4.getCells().add( "Item 2");
          row4.getCells().add( "Item 3");
          // Add the table to the page
          page.getElements().add( table );
    
          // Save the PDF
          document.draw("[Physicalpath/MyDocument.pdf");
    }
}  Top 
 Example 9: The following example shows you how to build a simple table.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.Cell2;
import com.cete.dynamicpdf.pageelements.Column2;
import com.cete.dynamicpdf.pageelements.Row2;
import com.cete.dynamicpdf.pageelements.Table2;
import com.cete.dynamicpdf.pageelements.FormattedTextArea;
public class MyClass
{
    public static void Main(String args[])
    {
          // Create a PDF Document
          Document document = new Document();
        
          // Create a Page and add it to the document
          Page page = new Page();
          document.getPages().add( page );
        
          // Create a table
          Table2 table = new Table2(0, 0, 600, 600);
        
          table.getCellDefault().setAlign(TextAlign.CENTER);
          table.getCellDefault().setVAlign(VAlign.CENTER);
          table.getBorder().setLineStyle(LineStyle.getSolid());
          table.setCellSpacing(5.0f);
        
          // Add columns to the table
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
        
          // Add rows to the table and add cells to the rows
          Row2 row1 = table.getRows().add( 0, Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey());
          row1.getCells().add( "Header 1" );
          row1.getCells().add( "Header 2" );
          row1.getCells().add( "Header 3" );
        
          Row2 row2 = table.getRows().add( 30 );
          row2.getCells().add( "Formatted Text", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                 Grayscale.getLightGrey(), 1 );
          String formattedText = "Formatted text area";
          row2.getCells().add( new FormattedTextArea( formattedText, 0, 0, 140, 15,
                FontFamily.getHelvetica(), 14, false ) );
          row2.getCells().add( "Item 1" );
        
          Row2 row3 = table.getRows().add();
          Cell2 cell2 = row3.getCells().add( "Rowheader 2", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
          row3.getCells().add( "Item 2" );
          row3.getCells().add( "Item 3" );
        
          Row2 row4 = table.getRows().add();
          row4.getCells().add( "Rowheader 3", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey(), 1 );
          row4.getCells().add( "Item 4");
          row4.getCells().add( "Item 5");
          // Add the table to the page
          page.getElements().add( table );
    
          // Save the PDF
          document.draw("[Physicalpath/MyDocument.pdf");
    }
}  Top 
 Example 10: The following example shows you how to build a simple table.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.Cell2;
import com.cete.dynamicpdf.pageelements.Column2;
import com.cete.dynamicpdf.pageelements.Row2;
import com.cete.dynamicpdf.pageelements.Table2;
import com.cete.dynamicpdf.pageelements.Rectangle;
public class MyClass
{
    public static void Main(String args[])
    {
          // Create a PDF Document
          Document document = new Document();
        
          // Create a Page and add it to the document
          Page page = new Page();
          document.getPages().add( page );
        
          // Create a table
          Table2 table = new Table2(0, 0, 600, 600);
        
          table.getCellDefault().setAlign(TextAlign.CENTER);
          table.getCellDefault().setVAlign(VAlign.CENTER);
          table.getBorder().setLineStyle(LineStyle.getSolid());
          table.setCellSpacing(5.0f);
        
          // Add columns to the table
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
        
          // Add rows to the table and add cells to the rows
          Row2 row1 = table.getRows().add( 0, Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey());
          row1.getCells().add( "Header 1" );
          row1.getCells().add( "Header 2" );
          row1.getCells().add( "Header 3" );
        
          Row2 row2 = table.getRows().add( 30 );
          row2.getCells().add( "Lines", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey(), 1 );
          AreaGroup lineGroup = new AreaGroup( 150, 150 );
          lineGroup.add( new Line( 25, 25, 125, 125, 5 ) );
          lineGroup.add( new Line( 25, 125, 125, 25, 5 ) );
          row2.getCells().add( lineGroup, 2 );
        
          Row2 row3 = table.getRows().add();
          Cell2 cell2 = row3.getCells().add( "Rowheader 2", Font.getHelveticaBold(), 16,
                  Grayscale.getBlack(), Grayscale.getLightGrey(), 1 );
          row3.getCells().add( "Item 1" );
          row3.getCells().add( "Item 2" );
        
          Row2 row4 = table.getRows().add();
          row4.getCells().add( "Rowheader 3", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey(), 1 );
          row4.getCells().add( "Item 3");
          row4.getCells().add( "Item 4");
          // Add the table to the page
          page.getElements().add( table );
    
          // Save the PDF
          document.draw("[Physicalpath/MyDocument.pdf");
    }
}  Top 
 Example 11: The following example shows you how to build a simple table.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.Cell2;
import com.cete.dynamicpdf.pageelements.Column2;
import com.cete.dynamicpdf.pageelements.Row2;
import com.cete.dynamicpdf.pageelements.Table2;
import com.cete.dynamicpdf.pageelements.Line;
import com.cete.dynamicpdf.pageelements.AreaGroup;
public class MyClass
{
    public static void Main(String args[])
    {
          // Create a PDF Document
          Document document = new Document();
        
          // Create a Page and add it to the document
          Page page = new Page();
          document.getPages().add( page );
        
          // Create a table
          Table2 table = new Table2(0, 0, 600, 600);
        
          table.getCellDefault().setAlign(TextAlign.CENTER);
          table.getCellDefault().setVAlign(VAlign.CENTER);
          table.getBorder().setLineStyle(LineStyle.getSolid());
          table.setCellSpacing(5.0f);
        
          // Add columns to the table
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
          table.getColumns().add( 150 );
        
          // Add rows to the table and add cells to the rows
          Row2 row1 = table.getRows().add( 0, Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey());
          row1.getCells().add( "Header 1" );
          row1.getCells().add( "Header 2" );
          row1.getCells().add( "Header 3" );
        
          Row2 row2 = table.getRows().add();
          row2.getCells().add( "Rectangle", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey(), 1 );
          Rectangle rect = new Rectangle( 0, 0, 90, 90, RgbColor.getYellowGreen(),
                  RgbColor.getBlue(), 2 );
          row2.getCells().add( rect, 2, 2 );
        
          Row2 row3 = table.getRows().add();
          row3.getCells().add( "Rectangle", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey(), 1 );
        
          Row2 row4 = table.getRows().add();
          row4.getCells().add( "Rowheader 3", Font.getHelveticaBold(), 16, Grayscale.getBlack(),
                  Grayscale.getLightGrey(), 1 );
          row4.getCells().add( "Item 1");
          row4.getCells().add( "Item 2");
          // Add the table to the page
          page.getElements().add( table );
    
          // Save the PDF
          document.draw("[Physicalpath/MyDocument.pdf");
    }
}
  Top