1

I have below html table which is displaying correctly by browser but has a wrongly shifted border when viewed by OpenOffice Writer (see the last image).

Please suggest what's gone wrong and can it be fixed without changing the markup.

    <html>
    <body>
    <table height="200">
        <tr>
           <td width=100 bgcolor="red" style="border:solid blue 4pt">
               1
           </td>
           <td width=100 bgcolor="gray" style="border:solid green 4pt">
               2<br>
               3<br>
               4<br>
               5
           </td>
        </tr>
    </table>
    </body>
    </html>

HTML table with solid-style border opened in Internet Explorer

HTML table with solid-style border opened in Open Office Writer

vtrz
  • 591
  • 1
  • 6
  • 12

1 Answers1

1

Have you tried to set the height element in the <td> cells ? It seems that it only covers the actual content of the cell not the table. Although this may be no good style it would be good for testing.

In addition, you could try to set the line-height: 200px of <tr> and ignore the height of table.

Update-------------------------------------------------------------------------

I found a html-editor that mimics the behavior of your openoffice: https://html-online.com/editor/

If you paste your code you can see that it narrows down the border to your content. If you change the height of the <td> to 200 it seems it could work. See the other picture. Let me know if it already works. I also installed OpenOffice to test it. If it doesnt work, tell me and I try it on openoffice too.

HTML after HTML before

Update 2--------------------------------------------------- What i could figure out is where the error lies: The internal rendering machine somehow ignores the border color option of <td> and instead manually inserts a <p> tag around your content in <td>, and sets the border for the <p> tag. Thus the content or to be correct the <p> tag gets your border element...im still thinking of how to trick the machine...as the normal way of html doesnt seem to work hereOpenOffice

*Update 3 See how the editor kills the style element and puts it instyle into the body element office

Patrick Bormann
  • 729
  • 6
  • 16
  • I have tried both your suggestions but they do not work. – vtrz Mar 02 '21 at 14:58
  • > Let me know if it already works. No it still does not work. OO renders it as on my second screenshot. – vtrz Mar 02 '21 at 17:13
  • Can you tell me how i open this in openoffice as html? Thus that it renders? Damn nasty tool ;-), i can only see the html code, doesnt matter what i do---HA found it..ok ill work on it – Patrick Bormann Mar 02 '21 at 17:27
  • Just right-click on the file and select Open With -> OpenOffice Writer. – vtrz Mar 02 '21 at 17:38
  • The openoffice editor kills every css im trying to write doesnt matter if its after the head or instyle. In addition he cuts the style tag after the tag and puts the css into the element e.g. if I write : body {background-color: beige;} in the style tag of your code it changes the body element to with a hex value, and deletes the style tag. The only option I see if you can turn out this auto instyle of openofficewriting, it seems it only adds style tags to some parent elemtns like body or table but i really dont know by which he chooses which element gets an instyle css. – Patrick Bormann Mar 02 '21 at 18:04
  • I see.. thank you very much for your research. – vtrz Mar 03 '21 at 06:16