java - HTML Custom JUnit Report Uneven Table Alignment -


i coding java class generates html table reports junit tests , use css visual formatting. having issue aligning cells since number of colummns generated unforseeable since of these columns represent parameters passed variadic function. therefore there inherent misalignment in columns. there way align these cells through css attribute or something? dont want alter underlying java code change aesthetic issue.

here sample table generated like:

http://lh5.ggpht.com/_n67dmbmmqmq/tk6q-vlhd3i/aaaaaaaaab8/jdfr1b5hx-k/junitreportexample.png

here html source table (formatted properly):

 <html>     <head>         <style type="text/css">             td              {                 font-family: "trebuchet ms", arial, helvetica, sans-serif;                 font-size: 1em;                 border: 1px solid black;                 padding: 3px 7px 2px 7px;             }         </style>     </head>     <body>         <table>             <tr>                 <td>                     <b>method:</b>                     <font color="blue" face="verdana">                         testone                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         1                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         1                     </font>                 </td>                 <td>                     <b>result:</b>                     <font color="green" face="verdana">                         passed                     </font>                 </td>             </tr>             <tr>                 <td>                     <b>method:</b>                     <font color="blue" face="verdana">                         testtwo                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         bmw                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         audi                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         mercedes                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         porsche                     </font>                 </td>                 <td>                     <b>result:</b>                     <font color="green" face="verdana">                         passed                     </font>                 </td>             </tr>             <tr>                 <td>                     <b>method:</b>                     <font color="blue" face="verdana">                         testthree                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         21154423                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         2443                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         12121                     </font>                 </td>                 <td>                     <b>result:</b>                     <font color="green" face="verdana">                         passed                     </font>                 </td>             </tr>             <tr>                 <td>                     <b>method:</b>                     <font color="blue" face="verdana">                         testfour                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         4.1222                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         2.0001                     </font>                 </td>                 <td>                     <b>result:</b>                     <font color="red" face="verdana">                     failed                 </td>             </tr>             <tr>                 <td>                     <b>method:</b>                     <font color="blue" face="verdana">                         testfive                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         10                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         10                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         kungsholmens hamn                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         melissa horn                     </font>                 </td>                 <td>                     <b>result:</b>                     <font color="green" face="verdana">                         passed                     </font>                 </td>             </tr>             <tr>                 <td>                     <b>method:</b>                     <font color="blue" face="verdana">                         testsix                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         sweden                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         sweden                     </font>                 </td>                 <td>                     <b>result:</b>                     <font color="green" face="verdana">                         passed                     </font>                 </td>             </tr>             <tr>                 <td>                     <b>method:</b>                     <font color="blue" face="verdana">                         testseven                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         lisa ekdahl                     </font>                 </td>                 <td>                     <b></b>                     <font color="purple" face="verdana">                         lisa ekdahl                     </font>                 </td>                 <td>                     <b>result:</b>                     <font color="green" face="verdana">                         passed                     </font>                 </td>             </tr>         </table>     </body> </html> </table> </body> </html> 

i don't think able simple css.

you don't want change java code aesthetic issue but, problem table shouldn't have changing number of columns. parameters columns should 1 column other means separate values. generate comma separated list of parameters in second column. way have 3 columns , thing far easier format properly.

if want keep values in separate columns, should use colspan attribute on last parameter. example last parameter column this, in java string (or whatever use generate html) looking :

"<td colspan="+ (maxnumberofcolumns-currentcolumnindex) +">" 

i suggest adjust java code this, alternatives (modifying javascript) lot more painful (even things jquery).


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -