Syncfusion Feedback

Trusted by the world’s leading companies

Syncfusion Trusted Companies

Overview

The Syncfusion .NET Word Library (DocIO) offers powerful APIs to programmatically split large Word documents into multiple smaller ones with ease. Achieve document segmentation in just a few lines of code, all without relying on Microsoft Word or interop dependencies.

Split Word documents using C#

This sample code shows how to split a Word document by sections using the Syncfusion .NET Word Library with just few lines of code in C#.

using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
// Open the Word document stream.
using (FileStream inputStream = new FileStream(@"Template.docx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
    // Load an existing Word document.
    using (WordDocument document = new WordDocument(inputStream, FormatType.Docx))
    {
        // Iterate through each section in the document.
        for (int i = 0; i < document.Sections.Count; i++)
        {
            // Create a new Word document for each section.
            using (WordDocument newDocument = new WordDocument())
            {
                // Add the cloned section to the new document.
                newDocument.Sections.Add(document.Sections[i].Clone());

                // Save the section as a separate Word document.
                using (FileStream outputStream = new FileStream(@"Section" + i + ".docx", FileMode.OpenOrCreate, FileAccess.ReadWrite))
                {
                    newDocument.Save(outputStream, FormatType.Docx);
                }
            }
        }
    }
}

Key features of splitting Word documents

Split by sections

Iterates through the document content section by section and saves each section as an individual Word document.

Split by headings

Extracts the content of a heading in the Word document by iterating the document contents and saves the extracted content as an individual Word document.

Split by placeholder text

Extracts a part of a document based on placeholder text and saves the extracted content as an individual Word document.

Split by bookmarks

Retrieves content within a bookmark and saves it as a separate Word document.

Syncfusion .NET Word Library Resources

Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.

Frequently Asked Questions

You can split a Word document by sections, bookmarks, headings, and placeholder text.

Yes, you can maintain the chapters’ titles with heading styles and split the Word document by headings using the .NET Word Library.

Yes, use the find functionality to find the keywords or content and then split the Word document into separate documents.

Yes, you can merge the split Word document’s pieces later using the merge functionality of the .NET Word Library.

Yes, you can programmatically split Word documents and convert them into PDF, image, or HTML formats.

You can access it through the Syncfusion.DocIO.Net.Core NuGet package. Detailed code samples and tutorial videos are available in the documentation.

Our Customers Love Us

Having an excellent set of tools and a great support team, Syncfusion® reduces customers’ development time.
Here are some of their experiences.

Rated by users across the globe

Want to create, View, and edit Word documents in C# or VB.NET?

Start a free 30-day evaluation today!
DOWNLOAD FREE TRIAL

No credit card required.

Mobile Free Evaluation Section

Awards

Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion® is proud to hold the following industry awards.

Scroll up icon