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
- Create an account and get API credentials
- Download Aspose.Words Cloud SDK for Dotnet to add hanging indent in a Word file
- Setup C# solution project with the above SDK for indenting paragraphs
Steps to Indent the First Line of a Paragraph with C# Low Code API
- Create an instance of the WordsApi class to indent paragraphs using the client ID and Secret
- Load the source Word file into a byte array for indenting selected text
- Create an object of the ParagraphFormatUpdate class and set the desired indentation
- Create the UpdateParagraphFormatOnlineRequest object using the input/output Word files and formatting parameters
- Call the UpdateParagraphFormatOnline() method to indent the desired paragraph
- 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.