Split DOCX into parts in C#

Fast C# library to split one DOCX file into a group of smaller files according to the given criteria.

Use .NET library to split DOCX files into parts. You can integrate the extracted DOCX pages with other data and, as a result, get documents of the form and content that you require. Splitting DOCX into parts makes it easier to collaborate on DOCX files.

View code snippet

Split DOCX in C#

This software library provides C# developers with a set of functions to split DOCX files into parts. Splitting a DOCX document into separate files can be used to make it easier to work with sections of a document in parallel. For example, if several people are working on one DOCX document at the same time, splitting it will allow them to speed up the work. The DOCX document splitting may be part of a technology for extracting text from DOCX files and integrating data into automated information systems or databases.

Our library provides C# developers with all the necessary functions to split DOCX files into parts and extract pages according to the specified mode. This is a stand-alone .NET solution that does not need Microsoft Word, Acrobat Reader or other applications installed.

Split DOCX document into parts using C#

Split DOCX content using different criteria in C# code. You can use the following page extraction modes for DOCX documents: 'split by headings', 'split by sections', 'split page by page', 'split by page ranges'.

After splitting your DOCX file into parts, you can export the result to the required file format using the 'Document.Save' method. You can also control how the DOCX document parts are exported to HTML or EPUB using the 'DocumentPartSavingCallback' property, which will allow you to redirect output streams.

Split DOCX documents easily with our solution for .NET. The following example shows how to split a DOCX document using C#:

C# code example to split a DOCX file
Upload a file you want to split
Run code
Select the target format from the list
using Aspose.Words;

var doc = new Document("Input.docx");
           
for (var page = 0; page < doc.PageCount; page++)
{
    var extractedPage = doc.ExtractPages(page, 1);
    extractedPage.Save($"Output_{page + 1}.docx");
}
Run code

How to split DOCX C#

  1. Install C# library to split DOCX files programmatically.
  2. Add a library reference (import the library) to your C# project.
  3. Open the DOCX in C#.
  4. Call the ExtractPages() method to extract specific pages from DOCX.
  5. Get the result of DOCX splitting as separate files.

C# library to split DOCX documents

There are three alternative options to install "Aspose.Words for .NET" onto your system. Please choose one that resembles your needs and follow the step-by-step instructions:

System Requirements

Our product is fully cross-platform and supports all major .NET implementations following '.NET Standard 2.0' specification:

  • Microsoft .NET Framework, starting from the earliest 2.0 version, and ending with the latest '.NET Framework 4.8'
  • .NET Core, starting from the earliest 2.0, and ending with the latest '.NET 6'
  • Mono >= 2.6.7

As far as .NET code doesn't depend on the underlying hardware or operating system, but only on a Virtual Machine, you are free to develop any kind of software for Windows, macOS, Android, iOS and Linux. Just make sure you have installed the corresponding version of .NET Framework, .NET Core, Windows Azure, Mono or Xamarin.

We recommend using Microsoft Visual Studio, Xamarin, and MonoDevelop integrated development environments to create C#, F#, VB.NET applications.

Fore more details please refer to Product Documentation.

Other supported DOCX split operations

You can also split DOCX to other file formats:

5%

Subscribe to Aspose Product Updates

Get monthly newsletters and offers directly delivered to your mailbox.

© Aspose Pty Ltd 2001-2024. All Rights Reserved.