This quick tutorial guides on how to export data from a PDF form to Excel using C#. It has all the details to set the environment using Aspose.PDF and Aspose.Cells to export PDF fields to Excel using C#. Detailed steps are shared for exporting data from PDF using one product and saving it as an Excel file using another product.
Steps to Export Adobe Form Data to Excel using C#
- Set the environment to use Aspose.PDF and Aspose.Cells for .NET
- Create an object of the Form class in Aspose.PDF and bind it with the source PDF file with the Form in it
- Create a stream object for an XML file and call the Form.ExportXml() method to export form data to the XML file
- Create an XmlLoadOptions class object from Aspose.Cells
- Load the XML file into the Workbook object using Aspose.Cells
- Save the workbook as an XLSX file for getting the form data in XML into it
These steps summarize the process to export PDF form data to Excel using C#. First, load the input PDF with Form using Form.BindPdf() and export it to an XML file on the disk using the Form.ExportXml() method. In the next step, load the XML file using Aspose.Cells.Workbook object and save the workbook as an XLSX file.
Code to Export Fillable PDF to Excel using C#
The above code sample describes how to extract data from fillable PDF to Excel using C#. We have used an object of the Aspose.Pdf.Facades.Form class that contains the BindPdf() method for linking the PDF with it. You may utilize the XmlLoadOptions object for customizing the loading of the newly created XML file, such as checking Excel restriction for loading size, flag to decide the number values conversion to a number or date in the Excel file, and control many other parameters.
This tutorial has taught us to read PDF Form data into an Excel file. To access individual fields in a form, refer to the article on Extract data from PDF Form using C#.