PDF to XLS Converter

The Documentize PDF to XLS Converter for .NET is a powerful tool that allows seamless conversion of PDF documents into Excel spreadsheets (XLS/XLSX). This plugin enhances the accessibility and usability of your PDF content, making it easy to manipulate and analyze data in spreadsheet format.

Key Features:

  • Convert PDF to Excel: Transform PDF files into XLS/XLSX spreadsheets for easy data management.
  • Custom Output Options: Configure the output format, page range, worksheet name, and more.
  • High-Fidelity Conversion: Retain layout, formatting, and content accuracy during conversion.
  • Batch Processing: Convert multiple PDF files in one go for large-scale operations.

How to Convert PDF to XLS

To convert a PDF document into an Excel file (XLS/XLSX), follow these steps:

  1. Create an instance of the PdfXls class.
  2. Create an instance of PdfToXlsOptions to configure the conversion settings.
  3. Add the input PDF file using the AddInput method.
  4. Specify the output Excel file using the AddOutput method.
  5. Run the Process method to initiate the conversion.
1var pdfXlsConverter = new PdfXls();
2var options = new PdfToXlsOptions();
3
4// Add input and output file paths
5options.AddInput(new FileDataSource(@"C:\Samples\sample.pdf"));
6options.AddOutput(new FileDataSource(@"C:\Samples\output.xlsx"));
7
8// Run the conversion process
9pdfXlsConverter.Process(options);

Customizing the PDF to Excel Conversion

You can customize the conversion settings by modifying the PdfToXlsOptions class. For instance, to convert the PDF to an XLSX format, insert a blank column, and name the worksheet, you can use the following code:

 1var options = new PdfToXlsOptions();
 2
 3// Set the output format to XLSX
 4options.Format = PdfToXlsOptions.ExcelFormat.XLSX;
 5
 6// Insert a blank column at the first position
 7options.InsertBlankColumnAtFirst = true;
 8
 9// Set the worksheet name
10options.WorksheetName = "MySheet";
11
12// Add input and output files
13options.AddInput(new FileDataSource(@"C:\Samples\sample.pdf"));
14options.AddOutput(new FileDataSource(@"C:\Samples\output.xlsx"));
15
16// Process the conversion
17pdfXlsConverter.Process(options);

Handling Conversion Results

After processing, the Process method returns a ResultContainer object that holds the result of the conversion. You can retrieve the converted file path or other output details:

1var resultContainer = pdfXlsConverter.Process(options);
2
3// Access and print the result file path
4var result = resultContainer.ResultCollection[0];
5Console.WriteLine(result);

Batch Processing for PDF to XLS Conversion

The PDF to XLS Converter plugin also supports batch processing, enabling the conversion of multiple PDF files at once.

 1var pdfXlsConverter = new PdfXls();
 2var options = new PdfToXlsOptions();
 3
 4// Add multiple input PDFs
 5options.AddInput(new FileDataSource(@"C:\Samples\file1.pdf"));
 6options.AddInput(new FileDataSource(@"C:\Samples\file2.pdf"));
 7
 8// Add the output Excel files
 9options.AddOutput(new FileDataSource(@"C:\Samples\output1.xlsx"));
10options.AddOutput(new FileDataSource(@"C:\Samples\output2.xlsx"));
11
12// Process the batch conversion
13pdfXlsConverter.Process(options);
 English