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

C# Excel - Delete Excel Document Page in C#.NET


Provides Users with Mature Document Manipulating Function for Deleting Excel Pages




Overview



C#.NET Excel document page deleting library control (XDoc.Excel) can be easily integrated into any C#.NET class applications to delete any unnecessary page from target existing Excel document file. Using RasterEdge Visual C# .NET Excel page deletion component, developers can easily select one or more Excel pages and delete it/them in both .NET web and Windows applications.


Related .net document control helps:
asp.net iis document viewer: C# HTML5 Viewer: Deployment on IIS
asp.net redact pdf: ASP.NET Redact PDF Document Control: redact, remove PDF text, images in web browser using C# ASP.NET
asp.net mvc pdf editor: ASP.NET MVC PDF Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
asp.net open pdf password: ASP.NET PDF Password Edit Control: online add, remove, update PDF file open password using C#
asp.net document viewer: ASP.NET Document Viewer Control in C#: View, Annotate, Redact web document files in ASP.NET using C#
asp.net annotate pdf: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
asp.net create pdf: ASP.NET Create PDF Document Control: create, convert PDF file from Word, Excel, Tiff file formats in C# ASP.NET


C#.NET Excel page removing & deleting library control SDK is a mature component on the market, which can also provides other Excel document page processing functions, such as Excel document merging function, Excel page rotating function, Excel page insert function, Excel page reordering function and Excel document splitting function.


This tutorial offers three pieces of C# sample codes for Excel page(s) deletion. XDoc.Excel enables you to delete Excel page(s) with customized options, including setting a single page, a series of pages, and random pages to be removed from Excel file.




C# DLLs: Delete Page from Excel Document


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;




Delete a Single Excel Page from Excel File in C#



How to delete a single page from a Excel document.




String filepath = @"";
String outPutFilePath = @"";
XLSXDocument doc = new XLSXDocument(filepath);

// Detele page 2 (actually the third page).
doc.DeletePage(2);

// Save the file.
doc.Save(outPutFilePath);





Delete Consecutive Pages from Excel in C#



How to delete a range of pages from a Excel document.




String filepath = @"";
String outPutFilePath = @"";
XLSXDocument doc = new XLSXDocument(filepath);

// Detele a series of 3 pages, starting from the second page. 
doc.DeletePages(1, 3);

// Save the file.
doc.Save(outPutFilePath);





Delete Specified Pages from Excel in C#



How to delete several defined pages from a Excel document.




String filepath = @"";
String outPutFilePath = @"";
XLSXDocument doc = new XLSXDocument(filepath);

// Get PageIndexes.
int[] detelePageindexes = new int[] { 1, 3, 5, 7, 9 };

// Delete pages.
doc.DeletePages(detelePageindexes);

// Save the file.
doc.Save(outPutFilePath);