This article guides how to add a border to a Word document with NET REST API. You will learn how to add border to Word with C# REST API using the .NET cloud SDK. We will use multiple properties of the border for the customization and select the target section and paragraph to apply a border.
Prerequisite
- Create an account and get API credentials
- Download Aspose.Words Cloud SDK for Dotnet to add a border in a Word file
- Setup C# solution project with the above SDK for drawing borders
Steps to Add Border in Word with C# REST API
- Initialize the WordsApi object by setting the cloned ID and secret to add a paragraph border
- Create an object of the UpdateBorderOnlineRequest class for applying a border
- Read the input Word file into the memory stream for drawing a border
- Create a Border class object, customize it, and set it into the request object
- Set node path, border type, and destination file in the request object
- Invoke the UpdateBorderOnline() method to add a border for a paragraph
- Save the output file from the API response
The above steps summarize how to insert a border in Word with C# Low Code API. Create the WordsApi object, declare the UpdateBorderOnlineRequest object and set its properties, read the input Word file into the request object, and set the node path, and border type. Finally, call the UpdateBorderOnline() method to apply a border to the target paragraph.
Code to Add Border on Word with C# Low Code API
This sample code exhibits how to place a border in Word with C# REST API. Use the Border class to set properties such as border type, line style, distance from text, line width, and shadow. Set the NodePath property to select the section and paragraph in the target Word file.
This article has taught us how to put a border in Word with NET REST API. If you are looking to insert a watermark in a Word file, refer to the following article: Add a watermark in Word with NET REST API.