Guide for VB.NET
Core Document Formats
Additional Features

VB.NET Excel - Excel Sheets Extraction Guide

.NET Solution to Extract Excel Sheet Using VB.NET Programming Code

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

How to extract specified sheet(s) from source Excel .xlsx document file using VB.NET programming solution? This VB.NET Excel sheet extracting online tutorial page will give you a great answer for this question. Following is a brief article layout.
Related .net document control helps: annotate pdf: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C# multipage tiff viewer: ASP.NET Tiff Viewer: view, annotate multipage Tiff images in ASP.NET MVC, WebForms using C# Control edit pdf text: ASP.NET PDF Text Edit Control: online edit PDF text content using C# ASP.NET pdf document viewer: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm... mvc document viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects excel web viewer: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser. sharepoint document viewer: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
  • What VB.NET APIs are offered to extract one or more Excel sheets?
  • What VB.NET demo codes can I use to extract sheet(s) from source .xlsx document file?
  • What are the features of this VB.NET Excel extraction control component?
Excel Extracting APIs
Four APIs are offered here to help VB.NET developers extract sheet(s) from source Excel document file. Two VB.NET APIs are used to extract one defined Excel sheet from target .xlsx document file and the other two APIs are used to get a specified range of sheets out of source Excel file.
Before showing you detailed VB.NET Excel sheet extracting APIs, we will first introduce two programming classes.
  • XLSXDocument: this programming class is used by this VB.NET Excel editing control SDK as a high-level Excel document model. That is to say, this VB.NET Excel manipulating library add-on will create an XLSXDocument object after it decodes source Excel file into VB.NET imaging application.
  • XLSXPage: XLSXPage can be counted as an abstraction of one Excel sheet.

Extract One Excel Sheet

Following two VB.NET APIs can be all used to extract one specified sheet from source Excel file. The difference is that the first API enables VB.NET developers to save extracted single sheet to memory stream and that the second API enables VB.NET programmers to store extracted one Excel sheet into .xlsx document format.
Private Sub GetOnePageDocument(sourceFilePath As [String], index As Integer, destnStream As Stream) Implements XLSXDocument.GetOnePageDocument
End Sub
Private Sub GetOnePageDocument(sourceFilePath As [String], index As Integer, destnFilePath As [String]) Implements XLSXDocument.GetOnePageDocument
End Sub

Extract More Excel Sheets

If you want to extract a list of sheets from source Excel document file, please try following VB.NET Excel sheet extracting APIs. Similar to above VB.NET APIs for one Excel sheet extraction, these two APIs allows developers to save extracted Excel sheets in the form of stream or Excel file format.
Private Sub ExtractPagesFromDocument(sourceFilePath As [String], pageIdxes As List(Of Integer), destnFilePath As [String]) Implements XLSXDocument.ExtractPagesFromDocument
End Sub
Private Sub ExtractPagesFromDocument(sourceFilePath As [String], pageIdxes As List(Of Integer), destnStream As Stream) Implements XLSXDocument.ExtractPagesFromDocument
End Sub
Note: This VB.NET Excel sheet extracting control add-on allows developers to load source Excel file from desired web path or specified file path.
VB.NET Demo Code
Accordingly, we here demonstrate two independent snippets of VB.NET demo codes. One is used to extract one sheet from Excel file and the other is for extracting a group of Excel sheets. If you want to see C# code on how to extract one or multiple sheets from source Excel file, please read this C#.NET Excel sheet extracting tutorial page.
Following VB.NET Excel sheet extracting demo code can help developers do three things: decide which Excel sheet will be extracted, extract specified sheet from source Excel file and create a new Excel file with extracted Excel sheet.
''' <summary>
''' Extract a single page and form a new document
''' </summary>
''' <param name="filePath"></param>
''' <param name="indx"></param>
''' <returns></returns>
Public Function GetOnePageDocument(sourceFilePath As [String], index As Integer, destnFilePath As [String]) As XLSXDocument
XLSXDocument.GetOnePageDocument(sourceFilePath, index, destnFilePath)
End Function
Using following VB.NET Excel sheet extraction sample code, you can extract several desired sheets from Excel file 1 and Excel file 2 respectively and then you combine the Excel sheets extracted from these two files into a new Excel .xlsx document file.
''' <summary>
''' Two Excel files are available, and we want combine some pages of document 1 and some pages of document 2 to form a new Excel document
''' </summary>
''' <returns></returns>
Public Sub ExtractPagesToFormNewDocument(filePath1 As [String], filePath2 As [String], pageList1 As List(Of Integer), pageList2 As List(Of Integer), destnPath As [String])
' two temporary strings to store the extracted documents file paths
Dim tmpFilePath1 As [String] = "c:\tmpFile1"
Dim tmpFilePath2 As [String] = "c:\tmpFile2"
XLSXDocument.ExtractPagesFromDocument(filePath1, pageList1, tmpFilePath1)
XLSXDocument.ExtractPagesFromDocument(filePath2, pageList2, tmpFilePath2)
Dim docPathList As List(Of [String]) = New List(Of String)()
XLSXDocument.Combine(docPathList, destnPath)
End Sub
Why to Choose
This section aims to help you have a complete and comprehensive understanding of this VB.NET Excel sheet extraction control add-on.

Easy to Install and Use

As all VB.NET Excel sheet extracting APIs are encoded into several RasterEdge compact dlls, developers can fully install this Excel sheet extracting control into VB.NET project by adding reference directly. But please make sure you have installed .NET Framework 2.0 or later versions and Microsoft Visual Studio 2005 or greater.

Own Compatibility with Other VB.NET Excel Sheet Processing Controls

If integrated other VB.NET Excel processing components, this VB.NET Excel sheet extraction control can do more processing functions at sheet level.

Suitable for Multiple .NET Developing Platforms

This VB.NET Excel sheet extracting control add-on enables developers to extract Excel worksheet(s) in both ASP.NET web and Windows Forms applications.

Recommend this to Google+ 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