This brief example is about how to convert PDF to Excel in C#. In order to export PDF to Excel C# based application can be used in any of .NET based supported operating system environment including Windows, Linux or macOS by using simple and easy API interfaces. You are not supposed to install any third party tool or Adobe Acrobat to perform the conversion.
Steps to Convert PDF to Excel using C#
- Install Aspose.PDF for .NET using NuGet package Manager in your application
- Include a reference to Aspose.PDF namespace in your project
- Initialize Document class instance to load PDF and convert that to XLSX
- Initialize ExcelSaveOptions object to set output XLSX file options
- Finally, Save method in C# convert PDF to Excel
By adhering to above steps in C# PDF to Excel conversion is easily done using simple API calls. The process will be started by adding necessary API references, which is then followed by loading source PDF file. In subsequent steps, ExcelSaveOptions class instance will be used to set the desired XLSX options. Lastly, the converted PDF file will be saved as XLSX on disk by using SaveFormat.Excel enumerator inside Save method.
Code to Convert PDF to Excel in C#
By using C# code to convert PDF to Excel, you can generate and open the XLSX file in any of Excel file viewers or uploading it to Google docs for viewing. The ExcelSaveOptions class allows you to set different export options that you would like to set for generated XSLX, including properties like ConversionEngine, Format, MinimizeTheNumberOfWorksheets and InsertBlankColumnAtFirst. If you want to export PDF to XLSX using default options, you can skip using ExcelSaveOptions class and its properties as well. Finally, the generated XLSX file is stored on disk using Save method.
In this topic, we have learnt about how to convert PDF to Excel using C#. If you are interested in exporting PDF to HTML, refer to the article on how to convert PDF to HTML in C#.