Td align is not working for .docx , any suggestion how to fix it and it's working perfectly for .doc

@ghs1 Could you please attach your source and output documents along with code that will allow us to reproduce the problem on our side? We will check the issue and provide you more information. Unfortunately, it is not possible to analyze the issue using screenshots.

above image is source code and below image is expected output

same code is working perfectly for .doc but it’s not for .docx

@ghs1 Could you please attach your actual source and output documents (zip them if forum does not allow to upload them) along with code that will allow us to reproduce the problem? We cannot use screenshots to analyze the problem.

Hi @alexey.noskov I have added actual code below and this code works perfectly for doc but docx td align = "justify" <alignment> is not working and margin top and bottom is not working in docx could u pls advise how to fix it.

I have attached code here
test__.docx (12.5 KB)

<table><tr><td align = "justify"><ol><li style="margin-top: 10px; margin-bottom: 10px;">Provided the Insured: <ol type="a"> <li style="margin-top: 10px;">QA TESTING Nothing herein provides coverage for matters relating to environmental protection as described in the Exclusions from Coverage of the policy jacket. </li> <li style="margin-top: 10px;">QA TESTING Nothing herein provides coverage for matters relating to environmental protection as described in the Exclusions from Coverage of the policy jacket.<span style="font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: Times New Roman;">&nbsp;&nbsp;</span><span style="text-align: justify; text-indent: -0.25in; font-size: 10pt; font-family: Arial, sans-serif;">&nbsp;</span> <p class="MsoListParagraphCxSpMiddle" style="mso-add-space: auto; text-align: justify; line-height: normal; mso-pagination: none; margin: 0in 0in 0in 35.45pt;"><span style="font-size: 10.0pt; font-family: Arial,sans-serif; mso-fareast-font-family: Times New Roman; layout-grid-mode: line;">&nbsp;</span></p> <p class="MsoListParagraphCxSpLast" style="mso-add-space: auto; text-align: justify; line-height: normal; mso-pagination: none; margin: 0in 0in 0in 35.45pt;">and provided:</p> </li> <li style="margin-top: 10px;">The written report indicates that there are no Work Order, Deficiency Notice against the Land, open permit or violation of a zoning by-law; and</li> <li style="margin-top: 10px;">At the Date of Policy, there are no Work Orders, Deficiency Notices against the Land or violation of a zoning bylaw registered against Title to the Land.</li> </ol> </li> </ol> </li></ol> </td></tr></table>

Expected output

@ghs1 Thank you for additional information. I have used the following simple code for testing:

Document doc = new Document(@"C:\Temp\in.html");
doc.Save(@"C:\Temp\out.docx");

Where in.html is the HTMl you have provided wrapped into <html><body>....</body><html> tags and the output looks like expected:
in.zip (843 Bytes)
out.docx (9.2 KB)

out.docx (9.2 KB)

@alexey.noskov could you please see your output .docx td align=“justify” is not working and margin top and bottom is not applying for docx.

@ghs1 You should use <td style="text-align: justify"> instead of <td align="justify"> to get the expected output.
in.zip (839 Bytes)
out.docx (9.2 KB)

Please note, Aspose.Words is designed to work with MS Word documents. HTML documents and MS Word documents object models are quite different and it is not always possible to provide 100% fidelity after conversion one format to another. In most cases Aspose.Words mimics MS Word behavior when work with HTML documents.

Hi @alexey.noskov Thanks for Update and now it’s working fine.

could u pls advice me li style=“margin-top: 10px;” and li style=“margin-bottom: 10px;”
not working docx, if not support then what’s the alternative for this?.

@ghs1
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-26553

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

The issues you have found earlier (filed as WORDSNET-26553) have been fixed in this Aspose.Words for .NET 24.5 update also available on NuGet.