onizet / html2openxml

Html2OpenXml is a small .Net library that convert simple or advanced HTML to plain OpenXml components. This program has started in 2009, initially to convert user's comments into templated Word.
MIT License
321 stars 109 forks source link

Table with set width and rowspan not respecting width #38

Open LuisMAlmeida opened 6 years ago

LuisMAlmeida commented 6 years ago

Hi!

I just ran across a issue where if you have something like this:

<table border='1' style='width:100%;line-height: 100%'>
    <thead>
        <tr>
            <th colspan='2' style='background-color: #0071ce;text-align: left;height:15px;'>
                <font style='color: white;font-weight: bold;' face='Arial'>
                    LANGUAGES SKILLS
                </font>
                <br>
                <font style='color: white;font-weight: bold;' face='Arial'>
                    Alot of text Alot of text Alot of text Alot of text Alot of text Alot of text Alot of text Alot of
                    text Alot of text Alot of text
                    Alot of text Alot of text Alot of text Alot of text Alot of text Alot of text Alot of text Alot of
                    text Alot of text Alot of text Alot of text Alot of text Alot of text
                </font>
            </th>
        </tr>
    </thead>
    <tbody>
        <tr rowspan='2' style='background-color: white;height:15px;'>
            <td style='width:150px;'>
                <font style='font-weight: bold;' face='Calibri'>Text</font>
            </td>
            <td>
                <font face='Calibri'>
                    Text
                </font>
            </td>
        </tr>
    </tbody>
</table>

The cells with rowspan don't apply the width:150px, the text of the header pushes the cell's length

I was able to replicate this is word using a generated document, BUT if you create a table in Word manually with the same structure this doesn't happen

Any insights on this?

Thank you Luís Almeida