
InputFileName = "d:\\pdftest\\DataTableExample.pdf" // The resultant pdf, that will contain the form fields filled with information from DataTableĪutoFiller. Close () // Create an object of AutoFiller classĪutoFiller autoFiller = new AutoFiller () // The input pdf file that contains form fieldsĪutoFiller. MaxColumn + 1, true ) // Closing the file stream to free all resourcesįstream. Worksheets // Exporting the contents of 7 rows and 2 columns starting from 1st cell to DataTableĭataTable dataTable = worksheet. Open ( fstream ) // Accessing the first worksheet in the Excel file Open ) // Opening the Excel file through the file stream Workbook workbook = new Workbook () // Creating a file stream containing the Excel file to be openedįileStream fstream = new FileStream ( "d:\\pdftestĮwBook1.xls", FileMode.

The DataTable class offers the capability to use the first row of the sheet as ColumnName. Input Pdf form was single page and resultant is five pages, because the number of data rows in excel sheet is 5.

Once the method is called a new Pdf form file is generated, which contains five pages with form filled based over the data from Excel sheet. We need to create an object of AutoFiller class and bind the Pdf form present in the above pictures and use the ImportDataTable method to fill the form fields using the data present in DataTable object. We would be extracting the data from the following excel sheet into DataTable object. In the Form specified above has one page, with three fields named as “ID”, “Name” and “Gender” consequently. In the following scenario we are going to using a PDF form, which contains three form fields named ID, Name and Gender. Make sure that, the Column name of DataTable is same as field name over PDF form. Then we need would be importing this data into Pdf form using ImportDataTable method of AutoFiller class. We would be using ExportDataTable method of Cells class of Aspose.Cells to export the data from Excel sheet in to DataTable object.


You can import data from XML file, DFD, XFDF, use API and even can use the data from Excel worksheet. NET offers various ways to fill the Pdf forms.
