We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Set First Line, Left & Right Indentation of Paragraphs in Word Document | C# .NET

My word document’s left margin is not even. I want to make the left margin even without disturbing the paragraphs.


Please compress the following resources into ZIP format and attach the .zip file here for testing:

  • A simplified source Word document
  • Your expected DOCX file showing the desired output. You can create this output file manually by using MS Word.

As soon as you get these pieces of information ready, we will then start further investigation into your particular scenario and provide you code to achieve the same expected output by using Aspose.Words.

left margin problem.zip (22.6 KB)


You can make use of indentation related properties of ParagraphFormat Class e.g. ParagraphFormat.FirstLineIndent, ParagraphFormat.LeftIndent, ParagraphFormat.RightIndent:

Document doc = new Document("C:\\Temp\\left margin problem\\before.docx");

foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true))
    para.ParagraphFormat.LeftIndent = 0;

doc.Save("C:\\Temp\\left margin problem\\21.9.docx");