-
Notifications
You must be signed in to change notification settings - Fork 128
Closed
Description
Describe the bug
When converting HTML that contains ordered (ol) or unordered (ul) lists to OpenXML, the bullet points or numbered items are not indented correctly in the resulting Word document. Items appear aligned with the left margin instead of being indented.
Expected behavior
Ordered and unordered lists in the Word document should reflect the same indentation as seen in HTML rendering.
Repro
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml;
using HtmlToOpenXml;
using var stream = new MemoryStream();
using var document = WordprocessingDocument.Create(stream, WordprocessingDocumentType.Document);
var converter = new HtmlConverter(document.AddMainDocumentPart());
await converter.ParseBody("""
<p>unordered list:</p>
<ul>
<li>first list item</li>
<li>second list item</li>
</ul>
<p>ordered list:</p>
<ol>
<li>first list item</li>
<li>second list item</li>
</ol>
""");
document.Save();
File.WriteAllBytes("converted.docx", stream.ToArray());Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

