Html to Docx Conversion with Table Style attribute

Home Forums Open-Xml-PowerTools Html to Docx Conversion with Table Style attribute

This topic contains 1 reply, has 2 voices, and was last updated by  Anonymous 3 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #7930

    Nilesh Chitale
    Participant

    Hi Eric,

    I am trying to convert html content to a DOCX file. Apart from Table border it is working fine.
    Below html is unable to convert to it’s equivalent Table in DOCX.

    <table cellspacing=”0″ cellpadding=”0pt” style=”width:442.8pt;border-collapse:collapse;”>
    <colgroup>
    <col width=”118″ />
    <col width=”236″ />
    <col width=”118″ />
    <col width=”118″ />
    </colgroup>
    <tr align=”left” valign=”top”>
    <td style=”width:77.75pt; padding-right:4.9pt; padding-left:4.9pt; border-top: 1pt solid #000000; border-right: 1pt solid #000000; border-bottom: 1pt solid #000000; border-left: 1pt solid #000000;”>
    <p lang=”en-US” style=”text-indent:0pt;margin-left:0pt;margin-top:0pt;margin-bottom:0pt;margin-right:0pt;font-family:’Times New Roman’;”> </p>
    </td>
    <td style=”width:166.3pt; padding-right:4.9pt; padding-left:4.9pt; border-top: 1pt solid #000000; border-right: 1pt solid #000000; border-bottom: 1pt solid #000000; border-left: 1pt solid #000000;”>
    <p lang=”en-US” style=”text-align:center;text-indent:0pt;margin-left:0pt;margin-top:0pt;margin-bottom:0pt;margin-right:0pt;font-family:’Times New Roman’;”>New York</p>
    </td>
    <td style=”width:77.75pt; padding-right:4.9pt; padding-left:4.9pt; border-top: 1pt solid #000000; border-right: 1pt solid #000000; border-bottom: 1pt solid #000000; border-left: 1pt solid #000000;”>
    <p lang=”en-US” style=”text-align:center;text-indent:0pt;margin-left:0pt;margin-top:0pt;margin-bottom:0pt;margin-right:0pt;font-family:’Times New Roman’;”>Boston</p>
    </td>
    <td style=”width:77.8pt; padding-right:4.9pt; padding-left:4.9pt; border-top: 1pt solid #000000; border-right: 1pt solid #000000; border-bottom: 1pt solid #000000; border-left: 1pt solid #000000;”>
    <p lang=”en-US” style=”text-align:center;text-indent:0pt;margin-left:0pt;margin-top:0pt;margin-bottom:0pt;margin-right:0pt;font-family:’Times New Roman’;”>Detroit</p>
    </td>
    </tr>
    </table>

    Table is crated but without border. Any help in this regards is much appreciated.

    Regards,
    Nilesh

    #9793

    Anonymous

    I shall start with answer given by @JasonPlutext on one of the similar questions at docx4j forum. I have to mention that I was using jars which had this issue. Then, I followed below link:

    https://www.docx4java.org/forums/docx-java-f6/convert-html-to-docx-with-rtl-for-hebrew-arabic-language-t2712.html

    and found the jars from the below comments on the above linked page:

    You can try https://docx4java.org/docx4j/docx4j-Imp … 180801.jar

    It contains https://github.com/plutext/docx4j-Impor … f378022303

    Could you please take a look at https://github.com/plutext/docx4j-Impor … iTest.java and add additional tests for mixed Hebrew/Arabic and left to right text, especially for any cases where you feel the implementation is not correct.

    Also, the jars were not downloading, so I searched the name of jars and downloaded them with all the dependencies from jardownload.com. Though the commons-codec and commons-io jars were 1.3, which need to be upgraded to latest jars for image getting displayed in docx format after conversion. But, make sure that the html is well formed since docx4j requires strict adherence to well formed html.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.