import com.aspose.pdf.*;
public class AsposeTest {

	public static void main(String[] args) throws Exception {//Main function to add a table to a PDF in Java
        		
        // Instantiate the license
        License lic = new License(); 
        lic.setLicense("Aspose.Total.lic");

        // Instantiate an empty PDF file
        Document pdfFile = new Document();

        // Create and get access to a new page
        Page pdfPage = pdfFile.getPages().add();

        // Create a table
        Table pdfTable = new Table();

        // Format the cells border  
        pdfTable.setDefaultCellBorder(new BorderInfo(BorderSide.All, 1.0f, Color.getBlue()));

        // Add few rows into the table
        for (int rowNumber = 1; rowNumber < 10; rowNumber++)
        {
            // Create a row class object and add it to the collection of rows in the table
            Row tableRow = pdfTable.getRows().add();

            // Add columns into the row
            tableRow.getCells().add("Data " + rowNumber);
            tableRow.getCells().add("Data " + rowNumber);
            tableRow.getCells().add("Data " + rowNumber);
        }
        
        // Add newly created table into the page
        pdfPage.getParagraphs().add(pdfTable);

        // Save the PDF file
        pdfFile.save("Table.pdf");

        System.out.println("Done");
	}
}