Convert Excel files to PDF in C# and VB.NET

The following example demonstrates how to convert Excel files from one format to another in C# and VB.NET.

You can load any Excel file format (XLS, XLSX, ODS, HTML, CSV, TAB, or TXT) and convert it into any other Excel file format (XLS, XLSX, ODS, HTML, CSV, TAB, or TXT). You can also convert it to PDF, XPS, or image format.

Note that below you have Run options with which you can upload your own input Excel file or download the current input file and verify if the conversion to PDF file is satisfactory.

Convert Excel to PDF Screenshot
Upload your file (Drag file here)
using GemBox.Spreadsheet;

class Program
{
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");

        ExcelFile ef = ExcelFile.Load("%InputFileName%");

        // In order to achieve the conversion of a loaded Excel file to PDF,
        // or to some other Excel format,
        // we just need to save an ExcelFile object to desired output file format.
        ef.Save("Convert.%OutputFileType%");
    }
}
Imports GemBox.Spreadsheet

Module Program

    Sub Main()

        ' If using Professional version, put your serial key below.
        SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY")

        Dim ef As ExcelFile = ExcelFile.Load("%InputFileName%")

        ' In order to achieve the conversion of a loaded Excel file to PDF,
        ' or to some other Excel format,
        ' we just need to save an ExcelFile object to desired output file format.
        ef.Save("Convert.%OutputFileType%")

    End Sub

End Module

Check next example or download examples from GitHub.