C#: Online Guide
How To: Word SDK
File: Split Word Document
File: Split Word Document
  |  
Home ›› XDoc.Word ›› C# Word: Split Word Document

C# Word - Split Word Document in C#.NET


Explain How to Split Word Document in Visual C#.NET Application




Overview



C# Word document splitting library control, XDoc.Word, provides an advanced C# programming way to split Word document into smaller Word files in .NET developing applications. c# convert excel to pdf without office, c# xamarin barcode scanner example, pdfsharp html to pdf mvc, export datagridview to pdf in vb.net 2008, asp.net pdf viewer control c#, c# parse pdf form. Using this C#.NET Word document splitting library control, C# developers can easily and accurately disassemble multi-page Word document into two or more separate Word document files by page(s).


Related .net document control helps:
asp.net edit pdf text using c#: ASP.NET PDF Text Edit Control: online edit PDF text content using C# ASP.NET
asp.net document viewer open source: EdgeDoc:ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...
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 word document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net mvc excel viewer: ASP.NET Excel Viewer in C# Control (MVC & WebForms): view Office Excel document in web browser.
c# asp.net mvc document viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects
asp.net sharepoint document viewer open source: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint


RasterEdge Visual C# .NET Word document splitter control toolkit SDK can not only offer C# developers a professional .NET solution to split Word document file but also provide them the ability to name outputted Word document files with a customized name pattern using a few lines of simple Visual C# code. how to convert pdf to text in asp net c#, c# convert pdf to word, c# pdf highlight text, pdf creator sdk c#, convert pdf to text using itextsharp in vb.net, c# redact pdf, vb.net pdf add pages.


This C#.NET Word document splitting library control offers developers an efficient Word document splitting approach, using which C# developers can split target Word document file by specifying a page or pages. show image asp.net mvc, pdf viewer in asp.net web application, how to edit pdf file in asp.net c#, best pdf preview in asp net c#, asp.net remove image from pdf file, asp net remove text from pdf javascript, mvc display pdf from byte array. If needed, developers can also combine generated split Word document files with other Word files to form a new Word file using RasterEdge XDoc.Word. Besides, in the process of splitting Word document, developers can also remove certain Word page from target Word file using C#.NET Word page deletion API.


Please note, Word file will be divided from the previous page of your defined page number which starts from 0. For example, your original Word file contains 4 pages. If your page number is set as 1, then the two output Word files will contains the first page and the later three pages respectively.




C# DLLs: Split Word File



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;




Split Word file into two files in C#



This is an C# example of splitting a Word file into multiple ones by number of pages.




String inputFilePath = Program.RootPath + "\\" + "1.docx";
String outputFilePath1 = Program.RootPath + "\\" + "Split1.docx";
String outputFilePath2 = Program.RootPath + "\\" + "Split2.docx";
String[] outputOps = new  String[] { outputFilePath1, outputFilePath2 };
//  split a Word file with options
DOCXDocument.SplitDocument(inputFilePath, 2, outputOps);





Split Word Document into Multiple Word Files in C#



You can use the following C# demo to split Word document to four files.




String inputFilePath = Program.RootPath + "\\" + "1.docx";
String outputFileName = "Output.docx";
int[] splitIndex = new int[3] { 1, 3, 5 }; // Valid value for each index: 1 to (Page Count - 1).

// Create output Word file path list
List<String> outputFilePaths = new List<String>();
for (int i = 0; i <= splitIndex.Length; i++)
{
        outputFilePaths.Add(Program.RootPath + "\\" + outputFileName + "_" + i.ToString() + ".docx");
}

// Split input Word file to 4 files:
// File 0: page 0.
// File 1: page 1 ~ 2.
// File 2: page 3 ~ 4.
// File 3: page 5 ~ the last page.
DOCXDocument.SplitDocument(inputFilePath, splitIndex, outputFilePaths.ToArray());