Focal Point
Retaining multiple spaces

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1191087331

July 09, 2004, 05:30 PM
<Jeff Plitt>
Retaining multiple spaces
When running a WF5.2.5 report in HTML or Excel formats a field that carries multiple contiguous spaces has only one space on the report output. For example '123XX 456' (two spaces) will appear as '123XX 456' (one space). In PDF format this is not true. The SQUEEZE setting is OFF. I have assumed that this is due to HTML limitation. Is there a simple way around the problem? Thanks.
July 09, 2004, 06:02 PM
<Pietro De Santis>
There's no simple way to ensure multiple blank spaces for HTML output. Web browser functionality forces multiple blanks to be displayed as 1 blank.

I've not tried this, but perhaps you could use the CTRAN or OVRLAY functions in a DEFINE to translate blanks to some other undisplayable character, which the browser most likely will not squeeze to 1 blank.

Pietro.
July 09, 2004, 06:26 PM
jimster06
Jeff-
Here's one solution right off the tech support site:
Problem:

How to add spaces between columns in an HTML report?


Solution:

Example:

DEFINE FILE CAR
AMPER/A1 WITH COUNTRY = HEXBYT(38, AMPER);
SEMI/A1 WITH COUNTRY = HEXBYT(59, SEMI);
NBSP/A6 WITH COUNTRY = AMPER | 'nbsp' | SEMI;
GAP/A36 WITH COUNTRY = NBSP | NBSP | NBSP | NBSP | NBSP;
END
TABLE FILE CAR
PRINT GAP AS ' ' GAP AS ' ' CAR MODEL SEATS
BY COUNTRY
ON TABLE SET STYLE *
TYPE=REPORT,GRID=OFF, $
ENDSTYLE
END

HTH
July 12, 2004, 04:28 PM
<Jeff Plitt>
Thanks for your suggestions.

The problem occurs within a field and spaces inside are valid in multiple positions so the 'between columns' example doesn't seem to apply directly. I have chosen to replace the spaces with an underscore via CTRANS for the time being and will experiment with other replacement values.
July 12, 2004, 09:04 PM
George Brown
& nbsp (I had to include a space between the &n or it would just show as a space) is the character for a space in html. You can try that instead of your underscore. It may or may not have the result you were looking for. So... & n b s p are the letters that need to be together with no spaces.
July 13, 2004, 09:25 AM
Tony A
Jeff,

One thing to note is that the & nbsp requires a semi colon terminator in HTML, but I think a possible solution to your display is to use the PRE tag in HTML.

Try the following example -

DEFINE FILE CAR
MY_TEXT/A80 = COUNTRY |
'     '
| CAR ;
MY_TEXT_PRE/A90 = '<PRE>' | MY_TEXT | '</PRE>' ;
END
TABLE FILE CAR
PRINT MY_TEXT MY_TEXT_PRE
END

The biggest downside is that the font used is not always acceptable for some company reports but it does overcome your problem!

Comparison of one line of the output would be -

ENGLAND JAGUAR
ENGLAND        JAGUAR


Good luck!

Tony

Edited to preserve the 5 spaces in the define
July 13, 2004, 02:17 PM
<Jeff Plitt>
Thanks for your responses.

Using Tony's suggestion has solved the problem for display in HTML and Excel. I appreciate your help.

Jeff
August 04, 2004, 07:09 PM
reFOCUSing
I'm trying to add extra spaces in a heading in HTML and EXL2K format. I was able to get jimster06's code to work in HTML. In EXL2K I tried concatenating spaces and that did not work I also tried <PRE> but in a heading < creates an error because its now looking for the field PRE.

Any help would be great.
August 04, 2004, 07:34 PM
susannah
This works for me, in html only, tho:
-SET &BLANK='&|nbsp;&|nbsp;&|nbsp;&|nbsp;&|nbsp;&|nbsp;&|nbsp;&|nbsp;&|nbsp;';
then use the &var called &BLANK in my headers or wherever i need it.
If i needed a virtual variable, then i'ld just stick it in the defines, same way.
That escape character, |, is what does the trick.

In Excel, Tony's way is cool;
August 04, 2004, 07:38 PM
<Pietro De Santis>
You may be able to code
<|PRE
in the HEADING