This short guide describes how to extract a table from PDF to Excel using C#. You will get details to configure the IDE for Aspose.PDF e Aspose.Cells, a list of steps and a sample code to obtain the table from PDF to Excel using C#. The provided sample code will demonstrate the entire code flow required to perform the operation.
Steps to extract data from a PDF table into Excel using C#
- Set the IDE to use both Aspose.PDF for .NET and Aspose.Cells for .NET in the same project.
- Applica la licenza Aspose.Total for using the API features without any limitation or watermark.
- Upload the source PDF file into the object of class Document.
- Create a new Excel file using the Workbook class and set a name for the first sheet.
- Analizza ogni pagina del file PDF
- Access all tables on each page and, for each table, access the text in every row and column.
- Write the content of each cell into the corresponding row and cell of the destination sheet of the Excel file.
- Adjust the row/column width and save the workbook.
These steps summarize how to extract a PDF into an Excel table using C#. Imposta l’IDE per lo sviluppo, applica la licenza, carica il PDF di origine, crea un nuovo file Excel e analizza ogni pagina del PDF. Retrieve the collection of tables on each page, analyze each table to extract the content of the individual cells, and copy it into the corresponding row and column in the destination sheet of the output Excel file.
Code to extract a table from PDF to Excel using C#
This code demonstrates how to extract a table from a PDF into Excel using C#. The sample code provided writes the plain text from the PDF table into Excel cells. È possibile preservare la formattazione utilizzando il font, la dimensione, lo stile grassetto/corsivo e il colore della cella PDF. It is also possible to detect numeric values and date-like values in the PDF table and use the appropriate format when writing to the Excel file.
This tutorial explains the process for transferring the contents of the PDF table into the Excel sheet. To convert a scanned PDF into an editable PDF, see the article Convert scanned PDF to editable PDF using C#.