Setting indents to zero changes word paragraph formatting

After.png (989.4 KB)
Before.png (1003.4 KB)

In a Microsoft Word document, I am setting the left and right indents to zero. The first line indent is set to twenty-five. Sometimes, part of the second line moves up to the first line, causing two words to jam together. I am using C# in Visual Studio on Windows 10.

            para.ParagraphFormat.LeftIndent = 0;
            para.ParagraphFormat.RightIndent = 0;
            para.ParagraphFormat.FirstLineIndent =25;

@granite61

Could you please ZIP and attach your input, problematic output and expected output documents here for testing? We will investigate the issue and provide you more information on it.

Here is the zip file

zero indent problem.zip (32.5 KB)

@granite61

You can use following code example to set the paragraph indentation for two paragraphs of document to generate the expected output.

Document doc = new Document(MyDir + "input.docx");
Paragraph paragraph = (Paragraph)doc.GetChild(NodeType.Paragraph, 22, true);
Console.WriteLine(paragraph.GetText());
paragraph.ParagraphFormat.FirstLineIndent = 25;
paragraph.ParagraphFormat.LeftIndent = 0;
paragraph.ParagraphFormat.RightIndent = 5;
paragraph = (Paragraph)doc.GetChild(NodeType.Paragraph, 23, true);
                
paragraph.ParagraphFormat.FirstLineIndent = 25;
paragraph.ParagraphFormat.LeftIndent = 0;
paragraph.ParagraphFormat.RightIndent = 5;

doc.Save(MyDir + "21.9.docx");

That was an excerpt from a 300 page manuscript.

Is the important thing putting the first line Indent first?

@granite61

No, it is not necessary.

You can use the same approach to set the desired properties of ParagraphFormat.

Thank you for all your help