How does Java set the first line indent of Figure 1 to the first line indent of Figure 2

Figure 1:

Figure 2:

@Mikeykiss You can use ParagraphFormat.FirstLineIndent to set these kind of indents. Use positive values to set the first-line indent, and negative values to set the hanging indent.

Document document = new Document("E:\\A.doc");
Paragraph para = new Paragraph(document);
ParagraphFormat paragraphFormat = para.getParagraphFormat();
paragraphFormat.setFirstLineIndent(10);"E:\\B.doc"); (6.2 KB)
Hello, indent the first line. What I want is that the indent value in paragraph format is 2 characters, using ParagraphFormat The FirstLineIndent method is still 0.85 cm,

@Mikeykiss Aspose.Words uses Points as the default measurement units. Most likely, in your case, MS Word is configured to use Centimeters. You can use ConvertUtil.millimeterToPoint to convert centimeters to points. Please see our documentation for more information: (234.9 KB)
Hello,Can the measurement unit be in characters,Set the indent value of paragraph format to 2 characters through Java code

@Mikeykiss You can use ParagraphFormat.CharacterUnitFirstLineIndent property to set firs line indent in characters.

Thank you. This method is useful. Please tell me what value the HTML text independent tag is set to. When converting to word, can it be converted to an indented value of 2 characters

@Mikeykiss Unfortunately, there is no way to specify paragraph first line indent in characters in HTML format.

hello,Use This Method
ParagraphFormat.CharacterUnitFirstLineIndent 1 property to set firs line indent in characters. From which aspose version this method is added

@Mikeykiss The property has been introduced in 20.4 version of Aspose.Words:

okay, thank you

1 Like