Add a Border to a Word Document with NET REST API

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

Steps to Add Border in Word with C# REST API

  1. Initialize the WordsApi object by setting the cloned ID and secret to add a paragraph border
  2. Create an object of the UpdateBorderOnlineRequest class for applying a border
  3. Read the input Word file into the memory stream for drawing a border
  4. Create a Border class object, customize it, and set it into the request object
  5. Set node path, border type, and destination file in the request object
  6. Invoke the UpdateBorderOnline() method to add a border for a paragraph
  7. 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.

 English