Using HtmlFragment getting a null reference exception when trying to double indent lists. Inputed HTML causing the issue.
TEST- Testing
Legacy
test
Just a huge font
- First numbered bullet
- Second
Calling it in code
var formattedText = new HtmlFragment(comment);
page.Paragraphs.Add(formattedText);
@smarion3mhealth
Could you provide input HTML and version you used to recreate the issue?
<li>TEST<ol><li><strong>Testing</strong></li></ol></li></ul><h2>Legacy</h2><h1>SOI All Service Lines test 5/9/2025</h1><p><span class=\"ql-size-huge\">Just a huge font</span></p><ol><li>First numbered bullet<ol><li>Second</li></ol></li></ol>
@smarion3mhealth
Thank you , I’ll investigate this issue and write you back shortly
@smarion3mhealth
I tried the following code on version 25.6 and 24.12, it seems working fine
static void html_fragment_issue()
{
string output = OutputFolder + "html_fragment_issue_out.pdf";
using (var doc = new Document())
{
var page = doc.Pages.Add();
var comment = "<li>TEST<ol><li><strong>Testing</strong></li></ol></li></ul><h2>Legacy</h2><h1>SOI All Service Lines test 5/9/2025</h1><p><span class=\"ql-size-huge\">Just a huge font</span></p><ol><li>First numbered bullet<ol><li>Second</li></ol></li></ol>";
var formattedText = new HtmlFragment(comment);
page.Paragraphs.Add(formattedText);
doc.Save(output);
}
}
html_fragment_issue_out.pdf (169.7 KB)
It’s possible that issue was fixed in later versions of Aspose.Pdf. What version did you used to recreate this error?