kannan-ar / MariGold.OpenXHTML

MariGold.OpenXHTML is a wrapper library for Open XML SDK to convert HTML documents into Open XML word documents.
MIT License
51 stars 21 forks source link

Table lets converter execute but output file is broken #18

Open Aless55 opened 2 years ago

Aless55 commented 2 years ago

I use this code to convert the html into openXML: var html is the table as string var filename is the filename as string

  WordDocument doc = new WordDocument(filename);
  doc.Process(new HtmlParser(html));
  doc.Save();

And following structure gives me problems in the convertion. The html is converted into a .docx file but when opening an "unknown error" appears. This makes it hard for me to debug. I read the following table from file.

<table>
 <tbody>
   <tr>
     <th colspan="1" rowspan="1" colwidth="260">asdasd</th>
     <th colspan="1" rowspan="1"></th>
     <th colspan="1" rowspan="1"></th>
     <th colspan="1" rowspan="1" colwidth="110"></th>
   </tr>
   <tr>
    <td colspan="1" rowspan="1" colwidth="260"></td>
    <td colspan="1" rowspan="1"> </td>
    <td colspan="1" rowspan="1"></td>
    <td colspan="1" rowspan="1" colwidth="110">{{Arbeitgeber.Hey}}</td>
  </tr>
  <tr>
    <td colspan="1" rowspan="1" colwidth="260">asxdasd </td>
    <td colspan="1" rowspan="1">asdasd</td>
    <td colspan="1" rowspan="1">asd</td>
    <td colspan="1" rowspan="1" colwidth="110">asd</td>
  </tr>
 </tbody>
</table>

I also tried removing the tag but it doesn't change anything.

@kannan-ar Could you point me to my error?

Aless55 commented 2 years ago

Edit I just saw that I get a divide_by_zeroE Error when opening the .docx file...

kannan-ar commented 2 years ago

I couldn't replicate the issue. Can you please post the word file generated?