Guide for VB.NET
Core Document Formats
Excel to PDF
Additional Features

VB.NET Excel - Excel to PDF Conversion

Easy to Complete Excel to PDF Document Conversion in VB.NET

VB.NET
Home > .NET Imaging SDK > VB.NET > Excel to PDF
To get started with DocImage SDK for .NET, you are supposed to read VB.NET Imaging: Get Started first!

Our VB.NET Excel Converting Library is often used by developers to convert Excel document to PDF in VB.NET project. We provide a tutorial page to help developers use our product for Excel to PDF conversion and the following three questions are mainly discussed on this page.
Related .net document control helps:
asp.net edit pdf page using c#: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#
asp.net edit pdf image using c#: ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
asp.net pdf viewer using c#: ASP.NET PDF Viewer Control: view, navigate, zoom Adobe PDF document in C# ASP.NET
asp.net sharepoint document viewer open source: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net mvc excel viewer: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.
c# asp.net image viewer: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
asp.net pdf document viewer c#: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm...
  • Are there free APIs for developers to convert Microsoft Excel document to PDF file using VB.NET programming?
  • Is there VB.NET sample code for Excel document converting to Portable Document Format?
  • What are similarities and differences between Excel document and PDF file in VB.NET class?
View the following sections in detail to find the answers to the above questions on Excel to PDF conversion in VB.NET application.
APIs to Be Used
VB.NET developers are free to use the following APIs to convert Excel document to PDF file in VB.NET programming. From these APIs, we can see that Excel document cannot be converted to PDF file directly. In the VB.NET programming, XLSXPage (representing one Excel worksheet) contained in XLSXDocument (an abstraction of your loaded or newly created Excel document) is rendered to REImage (a self-defined image object by RasterEdge) in the first place, then REImage can be converted and saved to PDF document format in VB.NET. You can also customize your Excel to PDF conversion application by setting supported rendering options in VB.NET Excel conversion process. In the process of converting Excel document to PDF file, REImage serves as an intermediate.
' Render Excel to get a REImage collection, or choose specific page to render
Private Function GetPage(pageIndex As Integer) As BasePage Implements XLSXDocument.GetPage
End Function
Private Function toImage() As BaseImage Implements XLSXPage.toImage
End Function
Private Function toImage(height As Integer, width As Integer) As BaseImage Implements XLSXPage.toImage
End Function

'Render Excel to desired document image format
Private Sub SaveImageFile(image As REImage, filePath As [String]) Implements REFile.SaveImageFile
End Sub
Demo Code in VB.NET Project
The following demo code can be used to convert Excel document to PDF file in VB.NET project with simple methods. In this VB.NET demo code, CovertXLSXDocumenttoPDF method is used to convert Excel document to PDF. To be specific, the GetPage method can be used to select one worksheet from your Excel document to create an XLSXPage object. After the XLSXPage object is generated, toImage method can be called to render XLSXPage to REImage. Finally, REImage can be converted PDF document file in VB.NET.
''' <summary>
''' Convert Excel to PDF
''' </summary>
''' <param name="ExcelFilePath"></param>
''' <returns></returns>
Public Function CovertXLSXDocumenttoPDF(ExcelFilePath As [String]) As PDFDocument
Dim doc As New XLSXDocument(ExcelFilePath)

Dim imgSource As New List(Of REImage)()

For i As Integer = 0 To doc.GetPageCount() - 1
Dim page As XLSXPage = DirectCast(doc.GetPage(i), XLSXPage)

Dim temp As REImage = DirectCast(page.ToImage(), REImage)
If temp IsNot Nothing Then
imgSource.Add(temp)
End If
Next

' create PDFDocument with image source

Return New PDFDocument(imgSource)
End Function
Note: You can load your target Excel document into the VB.NET programming from local file or stream.
Comparison of Excel & PDF
When you conduct Excel document conversion to PDF file in VB.NET application, do you know some similarities and differences between Excel document and PDF document?

Similarities

The following list demonstrates main similarities of Excel document and PDF file in VB.NET application.
  • Both Excel document and PDF file are developed by Microsoft.
  • Excel and PDF documents are widely used in office working.
  • Excel and PDF have multiple document processing properties.

Differences

Although both Excel and PDF are Microsoft documents, there have several differences. One obvious difference is that the PDF document is not editable and the Excel document is editable. Then, Portable Document Format is an electronic document format, not relating to operating systems. It means that PDF document can be used in Windows, Unix, Mac OS operating systems. But the Excel is a spreadsheet application developed by Microsoft, specifically used on computers with Microsoft Windows and Mac OS. So when using Excel or PDF document on your computer for VB.NET programming, you need to make sure whether the operating system is supportive. Finally, PDF document usually contains text, fonts, graphics and other information. But Excel features calculation and pivot tables.
This VB.NET tutorial page focuses on Excel document to PDF conversion. However, our .NET Excel Conversion SDK for VB.NET also supports rendering and converting Excel document to more document and image formats. For example, you can also convert Excel document to SVG using VB.NET, render Excel to TIFF image using VB.NET or complete Excel to Bitmap image conversion in VB.NET application.


Recommend this to Google+


RasterEdge.com is professional provider of ASP.NET MVC Document Viewer, ASP.NET PDF Viewer, MVC PDF Viewer document, content and imaging solutions, available for ASP.NET AJAX, Silverlight, Windows Forms as well as WPF. We are dedicated to provide powerful & profession imaging controls, PDF document, image to pdf files and components for capturing, viewing, processing, converting, compressing and stroing images, documents and more.

©2000-2017 Raster Edge.com