Solved

Formatting an HTML Email

Posted on 2011-09-17
7
252 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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 83

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
eclipse argument 14 61
replace a word with other 1 44
tomcat not starting 6 45
going to wrong jsp page 2 21
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…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

777 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