xyz
xyz

Reputation: 549

Embedding html table in email

I am trying to embed the html table in to email I am sending from one the application I am building below is what I am trying

<table width="400" style="border:1px solid #333">
  <tr> 
     <th>Isolate Lots</th>
     <th>Identification</th>
  </tr>  
  #foreach( $sample in $SAMPLES)
  #if($EXPSAMPLES[$foreach.index].getData("jax_trait_isolateIdentification") !="Unidentified")  
  <tr>
  <td>$LOTS[$foreach.index].name </td>
  <td>$EXPSAMPLES[$foreach.index].getData("jax_trait_isolateIdentification") 
  </td>
  </tr>
  #end #end
 </table>

The table in the email looks like this enter image description here

How can I put everything in the Cell inside the table and align them.

After edit

enter image description here

Upvotes: 0

Views: 214

Answers (3)

Ruslan
Ruslan

Reputation: 1303

Try to set style="vertical-align: middle" for each cell (since valign="middle" is obsolete).

<table style="border-collapse: collapse; width: 400px">
  <tr>
    <th style="border: 1px solid  #333; vertical-align: middle">Isolate Lots</th>
    <th style="border: 1px solid  #333; vertical-align: middle">Identification</th>
  </tr>
  <tr>
    <td style="border: 1px solid  #333; vertical-align: middle">name</td>
    <td style="border: 1px solid  #333; vertical-align: middle">jax_trait_isolateIdentification</td>
  </tr>
</table>

Upd: added borders

Upvotes: 1

Varsha
Varsha

Reputation: 89

well your code is correct maybe u should try this i just change the style of your table hope it works. enter code here

<table width="400" border='1px' style='text-align:center'>
  <tr> 
     <th>Isolate Lots</th>
     <th>Identification</th>
  </tr>  
  #foreach( $sample in $SAMPLES)
  #if($EXPSAMPLES[$foreach.index].getData("jax_trait_isolateIdentification") !="Unidentified")  
  <tr>
  <td>$LOTS[$foreach.index].name </td>
  <td>$EXPSAMPLES[$foreach.index].getData("jax_trait_isolateIdentification") 
  </td>
  </tr>
  #end #end
 </table>

Upvotes: 0

V1t0r
V1t0r

Reputation: 48

You did not specify what kind of alignment you mean, so here's my suggestion in case you want them centered, just added a 'align="center"' style to the cells.

<table width="400" style="border:1px solid #333">
  <tr> 
     <th align="center">Isolate Lots</th>
     <th align="center">Identification</th>
  </tr>  
  #foreach( $sample in $SAMPLES)
  #if($EXPSAMPLES[$foreach.index].getData("jax_trait_isolateIdentification") !="Unidentified")
  <tr>
  <td align="center">$LOTS[$foreach.index].name</td>
  <td align="center">$EXPSAMPLES[$foreach.index].getData("jax_trait_isolateIdentification")
  </td>
  </tr>
#end #end
 </table>

Upvotes: 0

Related Questions