Table alignment cascades to paragraphs when converting Word to HTML

I’m converting a
document.docx (16.5 KB)

to HTML using Aspose.Words for .NET. In the source document, I have a centered table that contains paragraphs which are explicitly left-aligned.

However, in the resulting HTML output, both the table and its inner paragraphs are rendered centered — the expected paragraph alignment (text-align: left;) is not preserved.

To troubleshoot, I tried enforcing the alignment programmatically:

var tables = document
    .GetChildNodes(NodeType.Table, true)
    .OfType<Aspose.Words.Tables.Table>();

foreach (var tbl in tables)
{
    tbl.Alignment = TableAlignment.Center;

    foreach (var node in tbl.GetChildNodes(NodeType.Paragraph, true))
    {
        var p = (Paragraph)node;
        p.ParagraphFormat.Alignment = ParagraphAlignment.Left;
    }
}

Despite this, the generated HTML
html.docx (27.4 KB)

still centers both the table and its inner paragraphs.

Is there a recommended approach to ensure paragraph-level alignment is maintained correctly when converting to HTML?

@saehem Could you please try to check the problem using the latest version of Aspose.Words. Here is my output html file, where you can see that the paragraphs inside the table are left aligned:

output.zip (807 Bytes)

Thank you for your reply. I’ve tried with the latest version of Aspose.Words which is 25.6.0.
The html output look fine on it’s own, but when I insert it into an email (Outlook online), since the paragraphs still doesn’t have explicit alignment, the alignment of the table cascades to the paragraph levels, so it will look like this:

I expected that using ParagraphAlignment set the alignment into the html as well.

@saehem I converted the document to html and copied the spreadsheet into an email and saw no difference:

You are using the evaluation version, so this may be related to it. Please get a temporary license Temporary License - Purchase - aspose.com and check your problem with it.