Page 1 of 1
HTML table does not display correctly
Posted: Wed Mar 03, 2021 11:38 am
by vtrz
I have below html table which has wrongly shifted cell borders when viewed by OpenOffice Writer (see attached images).
Please suggest what's gone wrong and can it be fixed without (or with a small) changing the markup.
Code: Select all
<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>
Re: HTML table does not display correctly
Posted: Wed Mar 03, 2021 1:25 pm
by erbsenzahl
(On Windows 10-64 pro)
OpenOffice 4.1.8 displays "wrong".
LibreOffice 7.1.0.3 displays like Browser.
Re: HTML table does not display correctly
Posted: Wed Mar 03, 2021 1:33 pm
by vtrz
erbsenzahl wrote:(On Windows 10-64 pro)
LibreOffice 7.1.0.3 displays like Browser.
Yes, but I'm interested in OO case.
Re: HTML table does not display correctly
Posted: Wed Mar 03, 2021 3:43 pm
by John_Ha
Probably a bug which a browser and LO cope with but AOO does not.
IIRC AOO isn't very good with HTML - use a proper, modern, up to date HTML editor.
Search the forum with
html for several posts - eg
ODT to HTML, formatting and
Can't create an HTML document which says
The HTML editor in [AOO and LO] still supports HTML 4 at best, so it's really a kind of Stone Age artefact.
Is your HTML correct?
HTML Tables says "Remember to define borders for both the table and the table cells."
I opened your HTML, added a new table and saved it as HML getting as below where your HTML was changed.
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice 4.1.9 (Win32)">
<META NAME="CREATED" CONTENT="0;0">
<META NAME="CHANGEDBY" CONTENT="John ">
<META NAME="CHANGED" CONTENT="20210303;13373227">
</HEAD>
<BODY LANG="en-GB" DIR="LTR">
<TABLE CELLPADDING=2 CELLSPACING=2 STYLE="page-break-before: always">
<TR>
<TD WIDTH=100 HEIGHT=192 BGCOLOR="#ff0000" SDVAL="1" SDNUM="2057;">
<P STYLE="border: 4.00pt solid #0000ff; padding: 0.05cm">1</P>
</TD>
<TD WIDTH=100 BGCOLOR="#808080">
<P STYLE="border: 4.00pt solid #008000; padding: 0.05cm">2<BR>3<BR>4<BR>5
</P>
</TD>
</TR>
</TABLE>
<P><BR><BR>
</P>
<P><BR><BR>
</P>
<TABLE WIDTH=100% BORDER=5 BORDERCOLOR="#3333ff" CELLPADDING=4 CELLSPACING=0 STYLE="page-break-inside: avoid">
<COL WIDTH=128*>
<COL WIDTH=128*>
<TR VALIGN=TOP>
<TD WIDTH=50% HEIGHT=360>
<P><BR>
</P>
</TD>
<TD WIDTH=50%>
<P><BR>
</P>
</TD>
</TR>
</TABLE>
<P><BR><BR>
</P>
</BODY>
</HTML>
Re: HTML table does not display correctly
Posted: Wed Mar 03, 2021 6:46 pm
by vtrz
Is your HTML correct? HTML Tables says "Remember to define borders for both the table and the table cells."
I see, but I can't correct it - at least can't replace those border styles on a simple
border=''1" table attribute - because it is generated automatically by another program (the HTML above is just a simplified example of generated table).