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

GemBox.Spreadsheet enables you to easily convert an Excel file to different file formats in C# and VB.NET. For example, you can convert Excel file to a different spreadsheet format (XLSX, XLS, ODS, CSV, or HTML) or to PDF, XPS, and image formats.

To do this, just load an Excel file and save it to another file format as in the following example. For more details about supported file formats in GemBox.Spreadsheet, see Supported File Formats help page.

Screenshot of PDF converted from Excel file with GemBox.Spreadsheet
PDF converted from Excel file with GemBox.Spreadsheet
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");

        var workbook = 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.
        workbook.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 workbook = 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.
        workbook.Save("Convert.%OutputFileType%")
    End Sub
End Module

Check next example or download examples from GitHub.