Lists imported from HTML use multiple numbering styles

Hi there,

I’ve discovered another minor inconsistency with HTML imports. When importing nested lists from HTML, the style appears to differ from a regular Word list. From my limited inspection of the generated document, it seems that the nested item uses a different list style from the non-nested items, producing additional space between items and inconsistent formatting. Here is a list of the issues I’ve observed:

  1. With “Auto” space after paragraphs, I would expect that list items would have no space following them, but due to the different formats, Word appears to add additional space between items.
  2. It also seems that the indentation level of nested items imported from HTML is slightly different from that of the default list style.

I’ve attached a reproduction below which demonstrates both of these inconsistencies.

using GemBox.Document;

ComponentInfo.SetLicense("FREE-LIMITED-KEY");

var doc = new DocumentModel();
var section = new Section(doc);
doc.Sections.Add(section);

var blocks = section.Blocks;

doc.DefaultParagraphFormat.SpaceAfterAuto = true;

ListStyle bulletList = new ListStyle(ListTemplateType.Bullet);

blocks.Add(new Paragraph(doc, "First item.")
{
	ListFormat = { Style = bulletList }
});
blocks.Add(new Paragraph(doc, "Second item.")
{
	ListFormat = { Style = bulletList, ListLevelNumber = 1 }
});
blocks.Add(new Paragraph(doc, "Third item.")
{
	ListFormat = { Style = bulletList }
});

blocks.Add(new Paragraph(doc));


var loadOptions = new HtmlLoadOptions
{
	InheritCharacterFormat = true,
	InheritParagraphFormat = true,
};

section.Content.End.LoadText("""
		<ul>
			<li>First item.
			<ul>
				<li>Sub item.</li>
			</ul>
			</li>
			<li>Third item.</li>
		</ul>
""", loadOptions);

doc.Save("test.docx");

My desired result is that the output from the programmatic list construction is as similar as possible to that of the HTML import. I am upgrading a legacy system which used a different library for Word document rendering, and I am aiming to achieve as much compatibility with the legacy implementation as possible. These inconsistencies with HTML imports are one of the few remaining issues left to solve, so I am greatly appreciative of any assistance.

Best,
Michael

Hi Michael,

Please try again with this NuGet package:

Install-Package GemBox.Document -Version 2025.8.134

Note that this is a hidden (unlisted) version. To install it, you’ll need to run the above command on the NuGet Package Manager Console (Tools → NuGet Package Manager → Package Manager Console).

Does this solve your issue?

Regards,
Mario

Hi Mario,

Thanks for your assistance on this matter. With the new version, it appears that the paragraph spacing issue is resolved. However, the indentation still differs between the HTML import and the manually constructed bullets. I’ve attached a screenshot of the results from the reproduction code above.

Thank you in advance for your continued assistance.

Best,
Michael

Hi Michael,

Please try again with this NuGet package:

Install-Package GemBox.Document -Version 2025.9.102

Note that this is a hidden (unlisted) version. To install it, you’ll need to run the above command on the NuGet Package Manager Console (Tools → NuGet Package Manager → Package Manager Console).

Does this solve your issue?

Regards,
Mario

Hi Mario,

That version appears to resolve all the issues. Thank you greatly for your assistance on this matter.

Sincerely,
Michael