{
"type": "ADJUST_RIGHT_INDENT",
"attributes": {
"val": "0"
}
},
To adjust the right indent of a paragraph in Aspose.Words for Java, you can use the ParagraphFormat
class, which provides properties to set various formatting options, including the right indent.
Here’s how you can set the right indent to a specific value (for example, 0) using the setRightIndent
method:
import com.aspose.words.*;
public class AdjustRightIndentExample {
public static void main(String[] args) throws Exception {
// Create a new document
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Access the paragraph format
ParagraphFormat paragraphFormat = builder.getParagraphFormat();
// Set the right indent to 0
paragraphFormat.setRightIndent(0);
// Add some text to the document
builder.writeln("This paragraph has a right indent of 0.");
// Save the document
doc.save("AdjustedRightIndent.docx");
}
}
In this example, we create a new document and use a DocumentBuilder
to add text. The setRightIndent
method is called on the ParagraphFormat
object to set the right indent to 0, which corresponds to the adjustRightInd
value you mentioned. Finally, the document is saved to a file.
For more detailed formatting options, you can explore the ParagraphFormat
class, which includes various properties for controlling paragraph layout and spacing.