Guide for VB.NET
Core Document Formats
Additional Features

VB.NET Excel - Excel Sheet Inserting Guide

How to Insert & Add New Worksheet into Excel File Using VB.NET Code

VB.NET
Home > .NET Imaging SDK > VB.NET > Insert Blank Page (Worksheet)
To get started with DocImage SDK for .NET, you are supposed to read VB.NET Imaging: Get Started first!

No matter whether you want to add a blank sheet or insert a worksheet extracted from another Excel file into target Excel .xlsx document, this VB.NET Excel worksheet inserting & adding control can help you achieve your goal. This detailed VB.NET Excel sheet programming tutorial page can help you find answers to following three questions.
Related .net document control helps:
asp.net mvc pdf editor control: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
document viewer asp.net c#: ASP.NET Document Viewer using C#: Open, View, Annotate, Redact, Convert document files in ASP.NET using C#, HTML5, JQuer...
asp.net edit pdf text control: ASP.NET PDF Text Edit Control: online edit PDF text content using C# ASP.NET
asp.net image viewer jquery: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
powerpoint viewer asp.net mvc: ASP.NET PowerPoint Document Viewer Control (MVC & WebForms): view ppt, pptx files online in C# using ASP.NET
asp.net annotate pdf control: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
asp.net office document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
  • What VB.NET APIs can I use to insert & add worksheet(s) into source Excel file?
  • What VB.NET demo codes are offered to insert & add worksheet(s) into Excel .xlsx file?
  • Why do I need to choose RasterEdge VB.NET Excel sheet inserting control?
Easy to Use APIs
The VB.NET APIs encoded in this Excel sheet insertion control add-on is advanced and easy to use. Here we present the two APIs that are used to add & insert Excel sheet using VB.NET programming code.
Private Sub InsertPage(page As BasePage, index As Integer) Implements XLSXDocument.InsertPage
End Sub
Private Sub AddPage(page As BasePage) Implements XLSXDocument.AddPage
End Sub
To help you better understand above VB.NET Excel sheet inserting APIs, we will here list some points that you may need to read before using these APIs.
  • XLSXDocument: this VB.NET Excel sheet adding control SDK treats each Excel file as an XLSXDocument object which contains all worksheets' information. This programming class is derived from REDocument.
  • XLSXPage: this class is defined by RasterEdge as a method to represent one Excel sheet. Therefore, in general, an XLSXDocument instance contains multiple XLSXPage objects. Note: for a better demonstration, we regard one Excel sheet as a page.
  • AddPage: this VB.NET Excel sheet adding & inserting control add-on offers two methods for users to add & insert worksheet. Using this AddPage method, VB.NET developers can just insert an Excel sheet at the end of source Excel file.
  • InsertPage: Similar to AddPage, this method can also insert a blank or an existed worksheet drawn from other document file into target Excel file. Different from AddPage, this InsertPage method allows VB.NET developers to insert the sheet at any specified location. That means you can decide where the Excel sheet will be inserted.
Sample VB.NET Code
From this part, you will find detailed VB.NET codes to insert & add Excel worksheet(s) into source Excel file via AddPage or InsertPage method.

How to Insert Excel Sheet

Here we list two snippets of VB.NET sample codes, both of which use the Excel sheet inserting method InsertPage. Using the first demo VB.NET code, you can insert an empty worksheet into source Excel file and you can specify the location by defining the page index. For instance, you want to insert an empty sheet as Excel Sheet 4 and you can achieve that by inputting the page index value as 3.
''' </summary>
''' <param name="doc"></param>
''' <param name="idx"></param>
Public Sub CreateAndInsertEmptyPage(doc As XLSXDocument, idx As Integer)
Dim page As XLSXPage = DirectCast(doc.CreateEmptyPage(), XLSXPage)
doc.InsertPage(page, idx)
End Sub
Using this VB.NET sample code, developers can insert one Excel sheet that is extracted from another Excel document into target Excel file. If you want to know detailed VB.NET code on how to extract Excel sheet from .xlsx file, please read this VB.NET Excel worksheet extraction tutorial page.
''' </summary>
''' <param name="doc"></param>
''' <param name="page"></param>
''' <param name="idx"></param>
Public Sub InsertPageToXLSXDocument(doc As XLSXDocument, page As XLSXPage, idx As Integer)
doc.InsertPage(page, idx)
End Sub

How to Add Excel Sheet

The following VB.NET sample code is mainly used to add an Excel sheet drawn from other Excel file source to the end of target Excel document.
''' <summary>
''' Add sheet to the end of the Excel document.
''' </summary>
''' <param name="doc"></param>
''' <param name="page"></param>
Public Sub AddPageToDocument(doc As XLSXDocument, page As XLSXPage)
doc.AddPage(page)
End Sub
Benefit List
This part aims to help developers have a general overview of this VB.NET Excel sheet inserting control add-on.

Easy to Install

In general, this VB.NET Excel sheet inserting & adding control can easily install by adding project reference and work successfully in VB.NET application if your project has installed .NET Framework 2.0 or later versions and Visual Studio 2005 or greater.

Able to Process Excel 2007 & Later Versions

As this VB.NET Excel sheet inserting control add-on owns the APIs to encode and decode .xlsx file, all Excel documents created by Excel 2007 & later versions are supported.

Support Other Excel Sheet Processing Functions

This VB.NET Excel sheet inserting & adding component can also support other Excel sheet processing functions, like deletion, sheet order sorting and sheet(s) extraction, if integrated with other libraries of VB.NET Excel processing SDK.


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