XDoc.Excel
Features
Tech Specs
How-to C#
Pricing

C# Excel Library
C# Excel - Extract or Copy Excel Pages to Excel File in C#.NET


Extract/Copy Excel Pages of Excel Document in C# Project





The Microsoft Office Excel, known as Excel document, is a widely-used form of file that allows users to open & read documents even though they are using different types of Excel processors. Besides, the capacity to be locked against editing or processing by others makes Excel file become increasingly popular among large enterprises and organizations.

Using this C#.NET Excel document page extract library control, developers can extract pages from Excel document. Using the library, you should be sure that the page index is valid.


Extract Excel Pages Using C#



You may choose extract pages of Excel file and save to Excel file.

XLSXDocument doc = new XLSXDocument(@"C:\1.xlsx");
int[] pageIndexes = new int[] { 1, 3};
doc.ExtractPages(pageIndexes, @"C:\extract.xlsx");


Copy Excel Pages and Append to Another Excel File Using C#



You may copy pages of Excel file and paste to another Excel file.

XLSXDocument doc = new XLSXDocument(@"C:\1.xlsx");
int[] pageIndexes = new int[] { 1, 3};
Stream stream = new MemoryStream();
//extract pages to stream
doc.ExtractPages(pageIndexes, stream);
FileStream fileStream = File.Open(@"C:\2.xlsx", FileMode.Open);
//paste the pages extracted to second word file
XLSXDocument.CombineDocument(new Stream[] { stream, fileStream }, @"C:\copy.xlsx");