Split Word File with NET REST API

This article guides on how to split Word file with NET REST API. You will learn the process to automatically extract pages from Word with C# REST API using the .NET cloud SDK. We will discuss different parameters to customize the output of the splitting process.

Prerequisite

Steps to Split a Word Document with C# Low Code API

  1. Instantiate an object of the WordsApi class to split the Word file
  2. Load the Word file into the file stream object
  3. Create the SplitDocumentOnlineRequest object with the input file, output file, and range of pages
  4. Call the SplitDocumentOnline object by using the above request object
  5. Fetch the target output page using the Result.Document.TryGetValue() method and save it on the disk

These steps describe how to split Word DOC with C# REST API. Commence the process by loading the source Word file followed by creating the SplitDocumentOnlineRequest object by providing the input document, output format, output file name, starting page, and ending page. Finally, call the SplitDocumentOnline method to split the document and save the desired output page on the disk.

Code for Online Word Document Splitter in C# Low Code API

This code demonstrates the process to extract pages from Word document with C# Low Code API. The destination file name is used as a prefix to the multiple output pages where ‘_page#’ is used as a postfix. It creates as many names as extracted from the source document using this scheme and can be fetched as demonstrated in the sample code where page 2 is saved on the disk.

In this topic, we have learned to develop a DOCX splitter with NET REST API. To merge Word files, refer to the following article: Merge Word documents with NET REST API.

 English