Guide for C#
Core Document Formats
Additional Features

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

C# Class Codes to Split Word Document within DocImage SDK for .NET

Visual C#
Home > .NET Imaging SDK > C# > Split Word
If this is your first time to use our DocImageSDK, we strongly suggest you reading How to Start first!

C# Imaging: Split Word Pages Overview
RasterEdge Word Add-On can be seamlessly integrated with users' .NET imaging applications. And this page is aimed at demonstrating Word document splitting function of RasterEdge .NET Imaging SDK in C# developing platform. Using DocumentSplit method, users are capable of cutting a Word document that owns massive pages into multiple Word files that have a single or multiple page(s). If you are looking for an easy to work, high performance and high fidelity Word pages splitting tool, our Word Document Add-on control SDK will meet all your needs.
Apart from Word document splitting function, this Word Add-on library also can be integrated within VB.NET, ASP.NET or .NET Windows Forms application to run other market leading processing operations, like Word document viewers including Word HTML 5 web viewer, Windows and mobile viewers, Word file annotation, Word page processing and Word file converting.
Following list displays the main contents of Word splitting function tutorial in C# class:
  • Detailed features and requirements of using Word document splitting control library in C# project
  • General steps on how to start a Windows application to run Word splitting operation in Visual C#
  • Sample method and code to split Word document into separate single-page or multi-page Word file(s)
C# Imaging: Word Spliting Features and Requirements
  • Easy to incorporate Word Document Add-on application to your .NET projects
  • Support integrating Word document functions into single and multi-threaded applications including IIS and Windows WF hosted applications
  • Mature .NET imaging decoder to open the target Word file pages just taking a few seconds
  • Quickly separate massive Word pages into multiple Word documents manually in C# class
  • Free to cut initial Word document into single-page or multi-page Word document(s) within the robust APIs
  • No need to be an image expert for the offering entire and easy to use sample code in C#
  • Customize the split Word files name and storage route as you wish
  • Completely searchable split Word documents in your C#.NET document image program
Steps to Split Word Document in C# Program
The following steps tell users how to split Word document using C# class with our .NET Imaging SDK and its mature Word Add-On toolkit. But before this, you need to start and activate a C# Windows project in Visual Studio 2005, .NET Framework 2.0 or any greater version. For how to create and run a VB.NET class project to apply Word pages splitting operation, please link to get detailed online guide.
  1. Open and start Visual Studio 2005, 2008 or 2010 version;
  2. Begin a Windows application in Visual C# language;
  3. Paste created developer license text file to your C#.NET project;
  4. In your C#.NET project, please integrate .NET Imaging SDK basic dll and its Word Add-On dll by adding project reference;
    • RasterEdge.Imaging.Basic.dll
    • RasterEdge.Imaging.MSWordDocx.dll
  5. Finally, please use Visual C# class code below to split Word document. Following usings are the namespace that will be used in the C# project:
using RasterEdge.Imaging.Basic;
using RasterEdge.Imaging.Basic.Core;
using RasterEdge.Imaging.Basic.Codec;
using RasterEdge.Imaging.MSWordDocx;
C# Method and Demo Code to Split Word Pages
If you have a massive Word document which you need to split into multiple files, please do take a few minutes to read following tutorial.

Method to Split Word Document in C#.NET

This tutorial will show you the method for splitting a Word document into single or multiple Word files in C# project. In addition, the page of new split Word document is adjustable within our document page handling solution.
public override List<BaseDocument> SplitDocument(int pageIndex);

Demo Code to Split Word Document in C#.NET

You may use following entire C# class demo code to split Word document into separate Word files in your Visual C#.NET programs. For more sample code and functions on C# Word document processing, please go to: Word processing functions in C# class.
using RasterEdge.Imaging.Basic;
using RasterEdge.Imaging.Basic.Core;
using RasterEdge.Imaging.Basic.Codec;
using RasterEdge.Imaging.MSWordDocx;



namespace RE__Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

public static string FolderName = "c:/";

private void button1_Click(object sender, EventArgs e)
{
string fileName = FolderName + "Sample.docx";

REDocument doc = REFile.OpenDocumentFile(fileName, new DOCXDecoder());//use DOCXDecoder open a Word file

List<BaseDocument> baseDocs = doc.SplitDocument(1);

int index = 0;

foreach (BaseDocument baseDoc in baseDocs)
{
// REImage reimage = (REImage)baseDoc.GetPage(0).ToImage();
index++;

REFile.SaveDocumentFile((REDocument)doc, fileName, new DOCXEncoder());
}

}

}
}


Recommend this to Google+