This article guides how to extract pages from Word with NET REST API. You will learn how to save pages as DOCX with C# REST API using the .NET cloud SDK. You will get various samples of identifiers for setting the start and end of the range for savings as a new Word file.
Prerequisite
- Create an account and get API credentials
- Download Aspose.Words Cloud SDK for Dotnet to extract a range from a Word file
- Setup C# solution project with the above SDK for saving a range to a Word file
Steps to Extract Page from Word Document with C# Low Code API
- Initialize the WordsApi class object to extract range from a Word file
- Create a request object using the SaveAsRangeOnlineRequest class to save a range
- Read the source Word file into the request object
- Define the start and end of the range to extract from the loaded Word file
- Extract the range using the SaveAsRangeOnline() method
- Save the output Word file containing the defined range of contents
The above steps present how to extract pages from a Word document with C# Low Code API. Start the process by creating the WordsApi class object, and the SaveAsRangeOnlineRequest request object by setting the input Word file contents, range start identifier, end identifier, and output Word file name. Call the SaveAsRangeOnline() method using the defined request object and save the output Word file returned in the API response object.
Code for Word Page Extractor with C# REST API
This code demonstrates how to save pages as DOC with C# Low Code API. You can set the range start and end using the identifier such as ‘page2’ set page number 2, page2:end set end of page number 2, document:end set end of the document, and ‘id0.0.0’ set the node path. These identifiers help in setting range from any node in the document to any desired position in the document and save the output in a separate Word file.
This article has taught us how to convert pages to Microsoft Word with C# Low Code API. If you want to extract metadata from a Word file, refer to the following article: Extract Metadata from Word Document with NET REST API.