Split documents into parts in C#

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

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

View code snippet

Split Word, PDF in C#

This software library provides C# developers with a set of functions to split Word, PDF, EPUB, HTML, DOCX documents into parts. Splitting text into separate files can be used to make it easier to work with sections of documents. The procedure of document splitting can be part of the technology for integrating data into automated information systems or databases.

Our library provides C# developers with all the necessary functions to extract document 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 a document into parts using C#

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

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

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

Code example in C# to split a document into parts
Upload a file you want to split
Run code
Select the target format from the list
dotnet add package Aspose.Words
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 a file C#

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

C# library to split files

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:

  • .NET ≥ 5.0
  • .NET Core ≥ 2.0
  • .NET Standard ≥ 2.0
  • .NET Framework ≥ 3.5
  • MonoMac
  • MonoAndroid
  • Xamarin

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.

Most popular file formats for splitting


Subscribe to Aspose Product Updates

Get monthly newsletters and offers directly delivered to your mailbox.

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