Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
Spreadsheet .NET
>
Tutorial
> Clone Sheet
The following example shows you how to duplicate worksheet.
C# example
using System; using Independentsoft.Office; using Independentsoft.Office.Spreadsheet; namespace Sample { class Program { static void Main(string[] args) { Workbook book = new Workbook("c:\\test\\input.xlsx"); Worksheet sheet1 = (Worksheet)book.Sheets[0]; Worksheet sheet2 = sheet1; book.Sheets.Add(sheet2); book.Save("c:\\test\\output.xlsx", true); } } }
VB example
Imports System Imports Independentsoft.Office.Spreadsheet Module Module1 Sub Main(ByVal args As String()) Dim book As New Workbook("c:\test\input.xlsx") Dim sheet1 As Worksheet = DirectCast(book.Sheets(0), Worksheet) Dim sheet2 As Worksheet = sheet1 book.Sheets.Add(sheet2) book.Save("c:\test\output.xlsx", True) End Sub End Module
Need help? Ask our developers:
Name*
Email*
Message*