drmacro / wordinator

Generate high-quality DOCX files using a simplified XML format (simple word processing XML).
Apache License 2.0
38 stars 8 forks source link

cell background colour not displaying correctly #40

Open davet2001 opened 3 years ago

davet2001 commented 3 years ago

What I did: Created test.html:

<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
  <body>
    <table border="1">
      <tbody>
        <tr>
          <td bgcolor="red"><p>text</p></td>
        </tr>
      </tbody>
    </table>
  </body>
</html>

Run java.exe -jar wordinator_1.0.3/wordinator.jar -i test.html -o out -x wordinator_1.0.3/html2docx/html2docx.xsl -t wordinator_1.0.3\src\test\resources\docx\Test_Template.dotx Open html and docx files

What I expected to happen: HTML shows 'text' in a red box docx shows 'text' in a red box

What actually happened: HTML shows 'text' in a red box docx shows 'text' in a white box

image

davet2001 commented 3 years ago

I also tried this:

<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
  <body>
    <table border="1">
      <tbody>
        <tr>
          <td bgcolor="red"><p>red</p></td>
          <td shade="FFFF00"><p>yellow</p></td>
        </tr>
      </tbody>
    </table>
  </body>
</html>

Both cells have a background colour of white.

I cannot get any colour to appear in my docx, other than the text colour of headings if I define them as non-black.

Is it possible to provide example html that converts to docx with coloured background cells?