Focal Point
Vertical column title to Excel

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

January 26, 2007, 09:34 AM
canderson
Vertical column title to Excel
I'm having a display problem with a vertical column title on an Excel spreadsheet. The column title is dynamic and heads a column of figures for a given month and year. In this case the title is Jan-06. It is returned to the .fex in a result set by a DB2 stored procedure as an alpha (char(6)) field. After the result set is saved on a HOLD file the field is exposed to the .fex with a read similar to the following: -READ HOLDTITL &MYTITL01.A6. A subsequent print statement puts the title and the data on the spreadsheet; e.g., PRINT MYTOTL01 AS '&MYTITL01'. If the report is sent directly to Excel, using ON TABLE SET ONLINE-FMT EXL2K, the column title appears as Jan-06 as one would expect. However, the requirement is to display the title vertically. After finding hints on this forum, and a day of trial and error, I was able to get the title to display vertically using an external style sheet and passing the report through HTML with code such as the following:
ON TABLE SET HTMLCSS ON
ON TABLE HOLD AS REPT001 FORMAT HTML
...
TYPE=TITLE,COLUMN=MY01,CLASS=rotate,
...
SET HTMLFORMTYPE=XLS
-HTMLFORM REPT001

Here is the .css file:
.rotate
{
mso-rotate:90;
vertical-align:top;
height:40;
font-weight:bold;
text-align:right;
}

However, now the column header displays vertically as 06-Jan, reading from bottom to top, instead of Jan-06. When I highlight the header cell on the spreadsheet it appears in the edit box as 01/06/2007. It seems that the HTML is converting the text to a date data type, which Excel interprets/converts to 06-Jan. Has anyone knowledge of how to get the header through HTML to Excel in its original form? Also, the column title preceding the vertical 06-Jan is split onto 2 lines, by design, with code in the print statement such as PRINT YTD_ERR_COUNT AS 'Total Errors-,YTD'. The more height I assign to the vertical header in the external style sheet, the greater the space between the 2 lines containing the preceding column header. Any ideas on closing the gap are welcome. Thanks.
February 01, 2007, 03:19 PM
Alan Main
Don't know about your vertical date format issue, but once you resolve that you might try this to close the gap in the preceding header:
Add some blank lines above or below the two actual lines to take up the space and float them up or down as you prefer-
e.g.
PRINT YTD_ERR_COUNT AS ' , , ,Total Errors-,YTD'
or
PRINT YTD_ERR_COUNT AS 'Total Errors-,YTD, , , '

you may find that you need to define an &var as a required space and use that instead of a typed space.
February 05, 2007, 04:22 PM
canderson
Thanks for the tip, Alan; it worked great.