InsertHtml - <br /> not "new line"- i want "new paragraph"

i want to insert following:

builder.InsertHtml( bla bla bla<br /> 1223 132123123213<br />");

Now i got a “new line” (shift+enter) for the
. How can i Change it to “paragraph” (enter only).

Hi Bernhard,

Thanks for your inquiry. DocumentBuilder.InsertHtml does not explicitly inserts new line (shift + enter) in the document. If
tag exists in the html, the new line will be inserted in the document. If you want to replace line break with paragraph break, please use following code snippet. Hope this helps you.

// Retrieve all paragraphs in the document.
NodeCollection paragraphs = doc.GetChildNodes(NodeType.Paragraph, true);
// Iterate through all paragraphs
foreach (Paragraph para in paragraphs)
    foreach (Run run in para.Runs)
        if (run.Text.Contains(ControlChar.LineBreak))
            run.Text = run.Text.Replace(ControlChar.LineBreak, ControlChar.ParagraphBreak);

If you still face problem, please attach the following resources here for testing:

  • Your input Word document
  • The HTML fragment
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

Thank you very much!