Monday, April 27, 2009

HTML Display in InstallAnywhere swing Panel.

As a Install Anywhere user you might have been asked to display HTML files in IA Swing panels quite a lot of time, as a installer developer its quite tedious for the engineer to code and format html files.
Recently I had a change to do the same thing here I followed a trick, created a nice word document with all the formatting (text, paragraph and alignment) then saved the file in filtered html format. The result was a nice looking html page with all the formatting present when viewed in IE.
 
Without worrying any thing I added the file into HTML display panel and few of the surprises came in front of me
 
1. The preview panel button showed my HTML document inside the SWING but all the formatting was lost.
2. When the project was build the HTML display panel showed the HTML inside the frame with lots of white spaces, although the formatting was there but some of the special characters were visible in it.
 
The above experience left me scratching my head as what might have gone wrong, if I am opening the same .htm in IE or other browser things look quite good then why do I see weired results in case of Installer panel???
 
After close inspection and ofcource some hit and tries answered me,  and here's what I found
 
1. If your html document uses tags like col span, table to format the content and wrap it after say 55 characters from left
2. If you use <p> paragraph in your html file to format the look and feel of your html document
3. If you use xhtml where a schema is present to validate the DOM elements in your html
 
You might get experience the same kind of UI issue, to resolve the issue use all the tags for do not intend to use col span, table, paragraph that restrict the rendering of html file from left to right.
 
The root course
 
Install Anywhere uses text wrap to format the rend erring of html in its swing panel, so when a pre formatted document is encountered by IA it tries to reformat it thereby resulting into lot of white space and sometimes a left to right scroll bar also appears thereby taking away the nice look of your html and also poses difficulty to the user to read the mesage.
 
Use the above mentioned ways to get rid of cosmetic but yet irritating bugs like this...

No comments: