We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Words converting Word document nested lists to HTML improperly

When converting word documents to HTML the nested bulleted lists are not translating properly. The nested bullet lists are very standard and simple numbered with bulleted into three levels. Aspose is translating them into separate lists

    tags with margin to give them indent. This is very problematic for us because there is no hierarchy and also does not work at all in mobile. Is there anything we can do to address this?sample1.zip (14.5 KB)

@shmeep

Could you please share the screenshot of problematic output HTML along with your expected output HTML here for our reference? We will then provide you more information about your query.

This is what I get from Aspose Words: AsposeOutput.zip (1.2 KB)
This is similar to what I want (minus some spacing and font stuff). I want the list hierarchy as it should be with these nested lists: ExpectedOutputApprox.zip (1.0 KB)
As it stands now it looks like Aspose is doing some things to just make it look exactly like word output, but this output is not really usable in a browser especially with any sort of CSS in mobile setting.

@shmeep

Please use the following code example to get the desired output. Hope this helps you.

Document doc = new Document(MyDir + "sample1.docx");
foreach (Paragraph paragraph in doc.GetChildNodes(NodeType.Paragraph, true))
{
    if (paragraph.IsListItem)
    {
        paragraph.ParagraphFormat.SpaceAfter = 0.0;
        paragraph.ParagraphFormat.SpaceBefore = 0.0;
    }

    if (paragraph.ToString(SaveFormat.Text).Trim().Length == 0
        && paragraph.NextSibling.NodeType == NodeType.Paragraph
        && ((Paragraph)paragraph.NextSibling).IsListItem)
    {
        paragraph.Remove();
    }
}

doc.Save(MyDir + "19.4.html");

Thank you, That works well.