[SOLVED] Wrap and center header text that falls onto multiple lines
Hi, I'm using WebFocus 8x trying to wrap and center the HDRTEXT, but can't figure out any way to center text that falls on multiple lines. Any suggestions?
TABLE FILE CAR
PRINT
CAR
DEALER_COST
RETAIL_COST
SALES
COMPUTE HDRTEXT/A150='THIS IS A LONG TEXT WHICH HAS TO WRAPPED TO TWO OR MORE LINES. CURRENTLY IT IS NOT DISPLAYED PROPERLY DUE TO THE LENGTH OF THE TEXT'; NOPRINT
HEADING
"<HDRTEXT"
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=HEADING,
SIZE=12,
JUSTIFY=CENTER,
STYLE=BOLD,
LINE=1,
WRAP=3,
$
ENDSTYLE
END
This message has been edited. Last edited by: FP Mod Chuck,
WebFOCUS 8 WebFOCUS 7705 Windows, All Outputs
October 19, 2017, 03:40 PM
Waz
Hi Ifra, please use the code tags, some of your code got lost.
Not sure if this will work, but could you place a field before and set its width to position your text in the center ?
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
October 19, 2017, 03:48 PM
Ifra
Waz - I updated the post with the code tags, so hopefully it's there now. I actually tried your suggestion and still no luck. The problem is that since there's a WRAP present the multiple lines aren't getting centered.
WebFOCUS 8 WebFOCUS 7705 Windows, All Outputs
October 19, 2017, 04:09 PM
Waz
Yes, and I just tried using MARKUP and adding to your text and still the same.
The Justify is being ignored.
Must be a setting or combination of WRAP and JUSTIFY
Waz...
Prod:
WebFOCUS 7.6.10/8.1.04
Upgrade:
WebFOCUS 8.2.07
OS:
Linux
Outputs:
HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!
October 20, 2017, 04:24 AM
Mikel
Hi Ifra.
My suggestion is "Divide and rule":
1. Divide text into smaller tokens (PARAG introduces a smart delimiter in the text). 2. Extract every line/substring (GETTOK). 3. Finally, you can control each line in the header.
TABLE FILE CAR
PRINT CAR DEALER_COST RETAIL_COST SALES
COMPUTE HDRTEXT/A150 ='THIS IS A LONG TEXT WHICH HAS TO WRAPPED TO TWO OR MORE LINES. CURRENTLY IT IS NOT DISPLAYED PROPERLY DUE TO THE LENGTH OF THE TEXT'; NOPRINT
COMPUTE HDRCDEL/A153 = PARAG(150, HDRTEXT, ',', 50, HDRCDEL) ; NOPRINT
COMPUTE HDRLIN1/A50 = GETTOK(HDRCDEL, 153, 1, ',', 50, HDRLIN1) ; NOPRINT
COMPUTE HDRLIN2/A50 = GETTOK(HDRCDEL, 153, 2, ',', 50, HDRLIN2) ; NOPRINT
COMPUTE HDRLIN3/A50 = GETTOK(HDRCDEL, 153, 3, ',', 50, HDRLIN3) ; NOPRINT
HEADING
"<HDRLIN1"
"<HDRLIN2"
"<HDRLIN3"
" "
ON TABLE SET PAGE NOLEAD
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=HEADING, JUSTIFY=CENTER, $
END
Regards. Mikel.
WebFOCUS 8.1.05, 8.2.01
October 20, 2017, 04:31 AM
Tony A
For PDF you can embed HTML tags and use MARKUP=ON to incorporate what you need -
TABLE FILE CAR
PRINT
CAR
DEALER_COST
RETAIL_COST
SALES
-* Added center HTML tags to enforce alignment
COMPUTE HDRTEXT/A150='<center>THIS IS A LONG TEXT WHICH HAS TO WRAPPED TO TWO OR MORE LINES. CURRENTLY IT IS NOT DISPLAYED PROPERLY DUE TO THE LENGTH OF THE TEXT</center>'; NOPRINT
HEADING
"<HDRTEXT"
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=HEADING,
MARKUP=ON, <====
HEADALIGN=BODY, <====
COLSPAN=4, <====
JUSTIFY=CENTER,
SIZE=12,
STYLE=BOLD,
LINE=1,
WRAP=3,
$
ENDSTYLE
END
Note that you will need to remove the <==== which I have used to show where I've made changes.
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
October 20, 2017, 10:59 AM
Ifra
@Tony - unfortunately the text is moved to the middle horizontally, but not exactly centered as it's still left aligned. It looks like the
<center>
tag isn't getting picked up.
@Mikel - a little bit of a dirty way to do it, but it did the trick! Thanks.