In order to gain fine-grain control over the width of columns, you must set the table layout to "fixed" by passing true into
CellTable.setWidth(String, boolean).
but I found that if table layout is fixed, then after setting the column width, if the column content is too width for the column, the extra content will be truncated, but not display in the next line.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<STYLE>
/* Set table to 'fixed' (fastest render) layout */
.fixed_table {
width:50%;
table-layout: fixed;
border-collapse:collapse;
}
/* this only affect tr, td under class .fixed_table */
.fixed_table tr,
.fixed_table td{
border:1px solid black;
}
/* this will affect all tr, td */
/* tr, td{border:1px solid black;} */
/* Set table to 'auto' (best fit) layout. This is the default */
.auto_table {
width:50%;
table-layout: auto;
}
</STYLE>
<TITLE>
Test HTML Table
</TITLE>
</HEAD>
<BODY BGCOLOR="white" >
<TABLE CLASS="fixed_table">
<TR>
<TD style="width:70%;">WERWEREREREREWREWREREWREWREWRWERWER longsfdsfdsfdfds</TD>
<TD style="width:10%;">234</TD>
<TD style="width:20%;">3434324234324323</TD>
</TR>
<TR>
<TD style="width:70%;">234</TD>
<TD style="width:10%;">345454366546455345TERRLONG</TD>
<TD style="width:20%;">row3</TD>
</TR>
</TABLE>
<br/>
<TABLE CLASS="auto_table">
<TR>
<TD>WERWEREREREREWREWREREWREWREWRWERWER longsfdsfdsfdfds</TD>
<TD>234</TD>
<TD>3434324234324323</TD>
</TR>
<TR>
<TD>234</TD>
<TD>345454366546455345TERRLONG</TD>
<TD>row3</TD>
</TR>
</TABLE>
</BODY>
</HTML>
In fact, if using pure html + css, if table layout is fixed, the column content will penetrate the next cell, but not truncate, but in gwt, I found that the content will really be truncated, so strange.