HTML table does not display correctly

Discuss the word processor
Post Reply
vtrz
Posts: 7
Joined: Tue Nov 08, 2016 12:20 pm

HTML table does not display correctly

Post 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>
Attachments
table-with-solid-style-in-oo.png
table-with-solid-style-in-ie.png
table-with-solid-style-in-ie.png (5.98 KiB) Viewed 1576 times
OpenOffice 3.1.1 on Windows 7
erbsenzahl
Volunteer
Posts: 265
Joined: Tue Apr 18, 2017 8:23 am
Location: Germany

Re: HTML table does not display correctly

Post by erbsenzahl »

(On Windows 10-64 pro)
OpenOffice 4.1.8 displays "wrong".
LibreOffice 7.1.0.3 displays like Browser.
LibreOffice current versions 24.x/25.x and OpenOffice 4.1.15
on LinuxMint 21 - 22 Mate, W10-64 pro
vtrz
Posts: 7
Joined: Tue Nov 08, 2016 12:20 pm

Re: HTML table does not display correctly

Post 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.
OpenOffice 3.1.1 on Windows 7
John_Ha
Volunteer
Posts: 9604
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: HTML table does not display correctly

Post 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>
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
vtrz
Posts: 7
Joined: Tue Nov 08, 2016 12:20 pm

Re: HTML table does not display correctly

Post 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).
OpenOffice 3.1.1 on Windows 7
Post Reply