<div><br></div> - single v/s double spacing

Hi,
We are using Aspose Words 20.2.0.0 version. I am getting inconsistent results when using this code. Sometimes I get single spacing and other times double spacing in the HTML “<div><br></div>”.

private DocumentBuilder InsertHtml(Bookmark item, DocumentBuilder builder, string strHtml, ADoc doc)
{
    doc.NodeChangingCallback = new HandleNodeChangingFontChanger();
    builder.ParagraphFormat.Alignment = ParagraphAlignment.Left;
    builder.InsertHtml(strHtml);
    doc.NodeChangingCallback = null;
    return builder;
}

Here’s the HTML that renders with single or double spacing:-

<table>
    <tr>
        <td style="vertical-align:top; padding-bottom: 11px;">
            <span style="width:70px;">1.&nbsp;</span>
        </td>
        <td colspan="2" style="vertical-align:top; padding-bottom: 11px;">
            The Proposed Insured must notify the Company in writing of the name of any party not referred to in this Commitment who will obtain an interest in the Land or who will make a loan on the Land. <div><br></div><div>The Company may then make additional Requirements or Exceptions.</div>
        </td>
    </tr>
</table>

Please advice.
Thanks,
V

@vrushalidixit
Please, ZIP and attach the source code with Html source string, source and output documents here we will check the issue and provide you more information.

Hi,
Please see the attached ZIP. It has the code. Change the path of the template and file output to run the code. I’ve attached a sample of failed and success output with the same code. Thanks.
ConsoleApp2.zip (5.0 MB)

@vrushalidixit Thank you for additional information. <div> tag is imported as a paragraph into Aspose.Words DOM. <br> is normally imported as a soft line break. But when it is the only content inside div it is ignored. So the following will produce simply an empty paragraph between paragraphs with text:

builder.InsertHtml("Content before DIV. <div><br></div><div>Content inside DIV.</div>");

However if you add content inside div like in the following example, there will be a soft line break:

builder.InsertHtml("Content before DIV. <div>line<br>line</div><div>Content inside DIV.</div>");

Hi,
I am not seeing similar results.
For:-

builder.InsertHtml("Content before DIV. <div><br></div><div>Content inside DIV.</div>");

This is what I am getting:-

@vrushalidixit In your project you are using old 20.2 version of Aspose.Words. As I can see your license allows you to update to the latest 22.9 version. The result I have shared was produced by the latest version of Aspose.Words.
https://www.nuget.org/packages/Aspose.Words

Hi,
We upgraded to 22.9 version and we are still experiencing the same issue of extra spacing.
Please advice as this is impacting our production users.
Thanks.

Aspose-Spacing-issue.zip (22.2 KB)

@vrushalidixit Could you please create a simple console application that will allow us to reproduce the problem? I have tested with the following simple code and cannot reproduce the problem on my side:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(File.ReadAllText(@"C:\Temp\InnerHtml.txt"));
doc.Save(@"C:\Temp\out.docx");

Here is the output document produced by the above code: out.docx (8.9 KB)