Inline Paragraph Styles are not working when opening HTML and Saving as Word or PDF

Hello!

I have HTML that I am attempting to convert to Word and PDF using Aspose.Words.NET v17.10.0.

When Paragraph tags have inline styles (specifically “margin”, “margin-top”, and “margin-bottom”), they are not converted. If I have an embedded style sheet that references all Paragraph tags, it does work. But if I try to use a class to style only some of the Paragraph tags, it again does not work.

Here is an example that does not work:

1. Open Meeting/Roll Call-Determination of Quorum

Inline styles on DIV tags also don’t seem to be implemented.

Here is an example of my code:

using (var loadMs = new System.IO.MemoryStream(HtmlData))
{
    var lo = new Aspose.Words.LoadOptions();
    lo.LoadFormat = Aspose.Words.LoadFormat.Html;

    var doc = new Aspose.Words.Document(loadMs, lo);
    using (var saveMs = new System.IO.MemoryStream())
    {
        doc.Save(saveMs, Aspose.Words.SaveFormat.Pdf);

        PdfData = saveMs.ToArray();
    }
}

Any help is appreciated!

–Jesse

@jsierks

Thank you for your inquiry. We have tested this feature using Aspose.Words API 17.12 HtmlLoadOptions and found it is working as expected HTML_to_DOCX_Documents.zip (5.7 KB). Please have a look at this sample code.

HtmlLoadOptions loadOptions = new HtmlLoadOptions();

loadOptions.LoadFormat = LoadFormat.Html;
loadOptions.Encoding = Encoding.UTF8;

Document doc = new Document(dataDir + @"Test.html", loadOptions);

doc.Save(dataDir + "Test_html_out.docx", SaveFormat.Docx);

Please share your Input document and output document that shows undesirable behavior to reproduce this issue at our end for resolution. We also suggest you to test with Aspose.Words API latest version 17.12 and share your feedback here. Thank you for your cooperation.

PS: To attach these resources, please zip and upload them.