Split Word Documents in C#

Split Word Documents in C#

Words Cloud .NET SDK provides an easy to use API to split DOCX, RTF, ODT and other file formats.
Cloud API has many split page features, such as:

  • Split pages no matter the length or file size.
  • Split page range.
  • Save as PDF, JPG, HTML, etc.

Overview

Use C# to split a Word document into multiple smaller files, or to extract pages to a new file.

Tip: Merging different Word documents is also possible.

Why split a Word document using C#?

While working with your documents, you may come across scenarios where you want to split large documents into smaller ones.
When scanning books, images or articles, you need to do it fast and all together. But in the end, you may want to separate pages of a Word document or any other document.
By splitting a document, you don’t need to send or print information you don’t want to.

What does split API for C# do?

  • Multi-page Word documents are divided into separate Word documents.
  • Split operation divides a multi-page Word document by page number, odd/even pages and by page range (entering the page range can be divided according to the page number of documents).
  • Split one big file into many smaller, one-page files. You can split them into multiple files, in various page ranges.
  • Keep style and layout of the source document.

Where and how?

Luckily for you, Words Cloud API has the answer.
The ability to split documents is one of four main feature areas of Words Cloud. It provides the simplest API to split a Word document within MS Word documents or other file formats.
Using an API client is the quickest way for a C# developer to speed up the development. API takes care of low-level details to make requests and handle responses. And this lets you focus on writing code specific to your particular project.

Getting Started

How to Split a DOCX document in C#

  1. Install NuGet package or use the direct download.
  2. Go to the Aspose Cloud Dashboard.
  3. Create a new Account to access all applications and services or Sign In to your account.
  4. Click on Applications in the left menu to get Client Id and Client Secret.
  5. Check Developer Guide to split a DOCX file in C#.
  6. Check API Reference page for the description of APIs parameters.

Split a Word document in C#
var appKey = "##################";
var appSid = "####-####-####-####-####";
var wordsApi = new WordsApi(appKey, appSid);

// Split all pages and save to PDF
var request = new SplitDocumentRequest("sample.docx", format: "pdf");
wordsApi.SplitDocument(request);

// Split page range 2-5 and save to JPEG
var request = new SplitDocumentRequest("sample.docx", format: "jpeg", from: 2, to: 5);
wordsApi.SplitDocument(request);

// Split all pages, save to HTML and zip output files
var request = new SplitDocumentRequest("sample.docx", format: "html", zipOutput: true);
wordsApi.SplitDocument(request);


  

Support and Learning Resources