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

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


Provides Users with Mature Document Manipulating Function for Deleting Word Pages




Overview



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


Related .net document control helps:
c# asp.net webforms document viewer: ASP.NET WebForms application document viewer control: view, annotate, redact, convert files online in ASP.NET
asp.net sharepoint pdf editor using c#: ASP.NET SharePoint PDF Editor Control: view, edit, annotate, redact PDF document in SharePoint sites
asp.net pdf viewer using c#: ASP.NET PDF Viewer Control: view, navigate, zoom Adobe PDF document in C# ASP.NET
c# asp.net dicom document viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
c# asp.net excel document viewer: ASP.NET Excel Document Viewer in C# Control: view office excel files online in ASP.NET web applications
c# asp.net image viewer: ASP.NET Image Document Viewer Control: view, annotate, redact, convert image files in html web browser
c# asp.net sharepoint document viewer: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint


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


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




C# DLLs: Delete Word Page



Add 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.Word.dll


  RasterEdge.XImage.Raster.Core.dll


  RasterEdge.XImage.Raster.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.Word;




Delete a Single Word Page from Word File in C#



How to delete a single page from a Word document.




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

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

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





Delete Consecutive Pages from Word in C#



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




String filepath = @"";
String outPutFilePath = @"";
DOCXDocument doc = new DOCXDocument(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 Word in C#



How to delete several defined pages from a Word document.




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

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

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

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