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

C# Word - Extract or Copy Pages from Word File in C#.NET

Extract/Copy  Pages of Word Document in C# Project


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

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

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

C# DLLs: Extract, Copy and Paste Word Page

Add references:











Use corresponding namespaces;

  using RasterEdge.Imaging.Basic;

  using RasterEdge.XDoc.Word;

Extract Word Pages Using C#

You may extract pages of Word file and save them to a new word file.

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

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

You may copy pages of Word file and paste them to another word file.

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