Hello Albert,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thanks for considering Aspose.
You can use the contents of Spreadsheet in fields over Pdf document. First you need to export the contents of worksheet into DataTable object using Aspose.Cells and than use AutoFiller class in Aspsoe.pdf.kit to fill the deginated fields in pdf.
Please use the following code snippet,
Workbook workbook = new Workbook();
//Creating a file stream containing the Excel file to be opened
FileStream fstream = new FileStream("C:\\book1.xls", FileMode.Open);
//Opening the Excel file through the file stream
//Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets;
//Exporting the contents of 7 rows and 2 columns starting from 1st cell to DataTable
DataTable dataTable = worksheet.Cells.ExportDataTable(0, 0, 7, 2, true);
//Binding the DataTable with DataGrid
dataGrid1.DataSource = dataTable;
//Closing the file stream to free all resources
// Create an object of AutoFiller class
AutoFiller autoFiller = new AutoFiller();
// The input pdf file that contains form fields
autoFiller.InputFileName = "C:\\pdftest\\DataTableExample.pdf";
// The resultant pdf, that will contain the form fields filled with information from DataTable
autoFiller.OutputFileName = "C:\\pdftest\\outputFile.pdf";
// call the method to import the data from DataTable object into Pdf form fields.
// call the save method to generate the pdf file
Make sure that, the Column name of DataTable is same as field name over Pdf file. I have created the Pdf file with form fields using Aspose.Pdf. Resource files used in code snippet are in attachment, please take a review.
For information on how to export worksheet data please visit Exporting Data from Worksheets
For information on filling form fields using AutoFiller class please visit AutoFiller
For information on creating form field using Aspose.pdf, pelase visit Manipulating Form Fields