views:

56

answers:

1

Hi everyone,

I am currently developing a Struts (1.3.10) application and I'm trying to show in a combo box a set of data. Every single option(row) is a String created by the union of 3 different Strings.

My question is if it's possible to tabulate that information in every option from the combo box, to show the information like the example you can see here:

Data1 | Data2 | Data3  
DataLargerThan1 | Data2 | DataLargerThan3  
DataMuchLargerThan1| DataLargerThan2 | Data3

it should be

Data1               | Data2           | Data3  
DataLargerThan1     | Data2           | DataLargerThan3  
DataMuchLargerThan1 | DataLargerThan2 | Data3

Is this possible? I'm trying to show formatted data with the pre tag, but I haven't got any result yet.

Thanks in advance, Carlos

+1  A: 

Best what you can do is to use non breaking spaces instead of normal spaces. That however require a precise knowledge of the font width in advance. It's the easiest in combination with a monospaced font as every character has a fixed width.

Example:

<select style="font-family: monospace;">
    <option>Data1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;Data2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;Data3</option>
    <option>DataLargerThan1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;Data2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;DataLargerThan3</option>
    <option>DataMuchLargerThan1&nbsp;|&nbsp;DataLargerThan2&nbsp;|&nbsp;Data3</option>
</select>
BalusC
Thanks for your information. It seems that with   it does preserve blank spaces. Thank you very much!
Carlos Pastor
You're welcome.
BalusC