Solved

Formatting an HTML Email

Posted on 2011-09-17
7
234 Views
Last Modified: 2012-08-13
Hi - I need to generate an HTML email which has a table of data embedded in it - the table has multiple rows and columns each of them with data of varying lengths - since this email is generated as HTML I am using whitespaces to separate the data in each row  

However the email that is generated does not look uniform and has data in a rows looking jumbled up - I found there is no exact formula so a whitespace entry does'nt necessarily translate to a whitespace in HTML.

Has anyone tried doing this and is there a way of generating a uniform HTML ?

Thanks
0
Comment
Question by:abuyusuf35
  • 4
  • 2
7 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 36554547
Are you separating the cell in HTML table with <td>stuff</td>?

I put &nbsp; only in those cells which have to be empty between the <td> and </td> tags - otherwise I just put required text between the td tags no matter how different in length it is
- if you have the same nimber of cells in each
row (rwos separated by </tr><tr>) I get uniform tables
0
 

Author Comment

by:abuyusuf35
ID: 36554557
How about elements within a row ? How can I space them out evenly ? Given that they are different lengths ? Thanks
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36554564
I don't do anything special - once you have the same number of cells it will adjust each cell to the row which have this cell longest - you'll have of course columns of different type
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 36554565
First try without any emails - just put your HTML to a file.html and open it with IE or Firefox - these things are the same -
your email will still be eventually formatted by the browser

Are you sending email from java with javamail ?
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 36554567
You would have to give each <td> a width like <td width='50px'>.  Also, in HTML, if you have more than one space ' ', only the first one is displayed.  If you want additional blank spaces, you have to use "&nbsp;" which is the code for 'non-breaking space'.

http://www.sitepoint.com/code-html-email-newsletters/
0
 

Author Comment

by:abuyusuf35
ID: 36554578
I tried using &nbsp;but is it not giving me an even row of elements I will try <td width='50px'> that might work
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36554591
Yes, if you put nothing the cells will be adjusted to the widest across the rows - if your data is of the same length you can put the width everywhere

you can also look here with lots of discussions on how to adjust the width of cells in HTML tables:
http://stackoverflow.com/questions/1057574/html-td-wrap-text
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
maven java path setting 5 50
json format text only 4 65
Groovy:unable to resolve class error 2 30
eclipse java  build path 6 18
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now