Saves all pages of the PDF document to Excel file

Namespace:  SautinSoft
Assembly:  SautinSoft.PdfFocus (in SautinSoft.PdfFocus.dll) Version: 6.6.9.7 (6.6.9.7)

Syntax

      
 C#  Visual Basic 
public int ToExcel(
	string fileName
)
Public Function ToExcel ( _
	fileName As String _
) As Integer

Parameters

fileName
String
Path to the Excel file

Return Value

0 - saving successfully
2 - can't create output file, check the output path
3 - saving failed, email to support@sautinsoft.com

Examples

CopyHow to convert PDF file to Excel file using C#
using System;
using System.IO;

namespace Sample
{
    class Sample
    {
        static void Main(string[] args)
        {
            string pathToPdf = @"..\..\..\..\..\Table.pdf";
            string pathToExcel = Path.ChangeExtension(pathToPdf, ".xls");

            // Convert PDF file to Excel file
            SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();

            // This property is necessary only for registered version
            //f.Serial = "XXXXXXXXXXX";

            // 'true' = Convert all data to spreadsheet (tabular and even textual).
            // 'false' = Skip textual data and convert only tabular (tables) data.
            f.ExcelOptions.ConvertNonTabularDataToSpreadsheet = true;

            // 'true'  = Preserve original page layout.
            // 'false' = Place tables before text.
            f.ExcelOptions.PreservePageLayout = true;

            f.OpenPdf(pathToPdf);

            if (f.PageCount > 0)
            {
                int result = f.ToExcel(pathToExcel);

                //Open a produced Excel workbook
                if (result==0)
                {
                    System.Diagnostics.Process.Start(pathToExcel);
                }
            }
        }
    }
}
CopyHow to convert PDF file to Excel file using VB.Net
Imports System.IO
Imports System.Drawing.Imaging
Imports System.Collections.Generic
Imports SautinSoft

Module Sample

    Sub Main()
        Dim pathToPdf As String = "..\..\..\..\Table.pdf"
        Dim pathToExcel As String = Path.ChangeExtension(pathToPdf, ".xls")

        ' Convert PDF file to Excel file
        Dim f As New SautinSoft.PdfFocus()

        ' This property is necessary only for registered version
        'f.Serial = "XXXXXXXXXXX";


        ' 'true' = Convert all data to spreadsheet (tabular and even textual).
        ' 'false' = Skip textual data and convert only tabular (tables) data.
        f.ExcelOptions.ConvertNonTabularDataToSpreadsheet = True

        ' 'true'  = Preserve original page layout.
        ' 'false' = Place tables before text.
        f.ExcelOptions.PreservePageLayout = True

        f.OpenPdf(pathToPdf)

        If f.PageCount > 0 Then
            Dim result As Integer = f.ToExcel(pathToExcel)

            'Open a produced Excel workbook
            If result = 0 Then
                System.Diagnostics.Process.Start(pathToExcel)
            End If
        End If
    End Sub
End Module

See Also