Indent Paragraph in Word with NET REST API

This article entails how to indent paragraph in Word with NET REST API. You will learn how to add a hanging indent in Word with C# REST API using the .NET cloud SDK. Various formatting options will be discussed in this article along with the sample code.

Prerequisite

Steps to Indent the First Line of a Paragraph with C# Low Code API

  1. Create an instance of the WordsApi class to indent paragraphs using the client ID and Secret
  2. Load the source Word file into a byte array for indenting selected text
  3. Create an object of the ParagraphFormatUpdate class and set the desired indentation
  4. Create the UpdateParagraphFormatOnlineRequest object using the input/output Word files and formatting parameters
  5. Call the UpdateParagraphFormatOnline() method to indent the desired paragraph
  6. Save the output stream from the API response into a local file on the disk

The aforementioned steps describe how to add hanging indent on Word with NET REST API. Commence the process by loading the source Word file, creating the desired format changes using the ParagraphFormatUpdate object, creating the request using the UpdateParagraphFormatOnlineRequest object, and indenting the paragraphs using the UpdateParagraphFormatOnline method. Finally, save the output Word file after adding online indentation to the uploaded file.

Code for Indenting Paragraphs with C# Low Code API

The sample code exhibits how to indent in Word with NET REST API. If you want a hanging indent set the FirstLineIndent parameter to a negative value, otherwise set it to a positive value in points for adding the first line indent. You may use other formatting parameters say alignment, line spacing, shading, etc. in the ParagraphFormatUpdate class to update the Word files online.

In this topic, we have learned how to indent paragraphs. If you want to learn the process of inserting a paragraph in a Word file, refer to the following article: Insert paragraph in Word with NET REST API.

 English