How to restart line number for paragraphs after HTML to DOCX using .NET

Hi, is there a way to have line numbering restarted on every paragraph? let’s say I have two paragraphs, first one has 10 lines, then line numbers will show from 1 to 10, then I have a second paragraph that has 5 lines, then line numbers after previous paragraph will restart from 1 to 5, is that possible?

Thanks in advance

@maik1

In your case, we suggest you please restart line number for each section. You can achieve your requirement by following solution.

  1. Import the document into Aspose.Words’ DOM.
  2. Iterate over paragraph nodes and move the cursor to the end of paragraph.
  3. Insert the section break continuous using DocumentBuilder.InsertBreak method.
  4. Please set the value of PageSetup.LineNumberRestartMode property to LineNumberRestartMode.RestartSection.

Hope this helps you.