Estrai una tabella da PDF a Excel usando Java

Questa guida rapida spiega come estrarre una tabella da PDF a Excel usando Java. You will get information to set up the environment, a list of steps, and sample code to extract the table from PDF to Excel using Java. All the necessary details are shown to access each individual table on any PDF page, retrieve the text of all cells, and copy the content into the corresponding cell in the output workbook.

Steps to extract a table from PDF to Excel with Java

  1. Set up the environment to use Aspose.Total for Java to extract the PDF table into the Excel sheet.
  2. Applica la licenza Aspose.Totale per i prodotti Aspose.PDF e Aspose.Cells
  3. Carica il file PDF di origine nell’oggetto classe Document
  4. Create an empty Excel file using the Workbook class of Aspose.Cells
  5. Analyze each page of the PDF and access the collection of tables on each page.
  6. Iterate through all pages and access each cell one at a time.
  7. Retrieve the text from each cell and save the content in the corresponding row and column of the destination sheet.
  8. Automatically adjust the columns in the sheet and save the output Excel file.

Follow these steps to obtain the table from PDF to Excel using Java. Start the process by loading the source PDF file, accessing all pages, analyzing each page separately, obtaining the collection of tables on each page, and accessing each cell in the selected table. Combina il testo all’interno di una cella in una stringa e salva il contenuto nella rispettiva riga e colonna del foglio specifico del file Excel di output.

Codice per estrarre una tabella Excel da PDF con Java

Questo codice dimostra come estrarre dati da una tabella PDF in Excel usando Java. Il formato del testo del PDF di origine può essere applicato alla tabella del foglio Excel recuperando il colore della cella della tabella PDF, lo stile grassetto/corsivo, il nome e la dimensione del carattere, e impostando gli stessi nella cella Excel durante la scrittura del contenuto. Pay attention when handling the merged tables in the PDF and when creating them in the Excel file to maintain the same organization of the table contents.

This article explains the process of copying text from a PDF table to a table in an Excel sheet. To convert a scanned PDF into an editable PDF, refer to the article Convert scanned PDF to editable PDF using Java.

 Italiano