C#: Online Guide
How To: excel SDK
Page: Extract Excel Pages
Page: Extract Excel Pages
  |  
Home ›› XDoc.Excel ›› C# Excel: Extract Excel Pages

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


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




Overview



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.


Related .net document control helps:
c# asp.net pdf editor: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
c# asp.net tiff viewer: ASP.NET Tiff Viewer: view, annotate multipage Tiff images in ASP.NET MVC, WebForms using C# Control
asp.net mvc pdf editor using c#: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
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...
c# asp.net text file viewer: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net edit pdf page using c#: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#
c# asp.net powerpoint viewer: ASP.NET PowerPoint Document Viewer Control (MVC & WebForms): view ppt, pptx files online in C# using ASP.NET


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.




C# DLLs: Excel Page Extraction


Add necessary references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.XDoc.Office.Inner.Common.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XDoc.Office.Inner.Office03.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.XDoc.Excel.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XImage.Raster.dll


Using namespaces:


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.Excel;




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");