Focal Point
[CLOSED]convert 'line break' from html to pdf document

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

January 13, 2017, 05:32 AM
WFtESTER
[CLOSED]convert 'line break' from html to pdf document
hi all

In an html file a user can fill out a text field.

it will be sent to the variable &TEXTFIELD and displayd on an pdf compound document.

all line breaks are disapearing and it will write everything on one line. I tried to convert this line breaks but without success so far.

  
-SET &TEXTFIELD = TRIMV('B', STRREP(1000,&TEXTFIELD.QUOTEDSTRING,2,HEXBYT(013, 'A1')|HEXBYT(010, 'A1'),4,'<BR>',1000,'A1000V'), 1000, ' ', 1, 'A1000V');


not sure if HEXBYT is only for html but not for pdf. should I work with CR and LF? any idea how to achieve this or any links for documentation (which I couldn't find yet).

many thanks

This message has been edited. Last edited by: Tamra,


WebFOCUS 8.1.0.5 (Server + Client)
Windows 2012 R2
BW, Oracle, Excel, PDF, HTML
January 13, 2017, 03:20 PM
susannah
CRLF/A2= HEXBYT(13,'A1') | HEXBYT(10,'A1');
D_C/A2500= 'D. Explanation:'| CRLF | D_COMMENTS;

for pdf output from a very old application written in 7.1.4. {ouch! hey I still think 4.3.6 rocks]

in 77, I now just use commas in my col titles, no hexbytes needed. don't know about 8.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
January 13, 2017, 04:12 PM
WFtESTER
hi susannah

thank you for the suggestion. I do not get it to work. here my example with the car data base:

DEFINE FILE CAR
CRLF/A2= HEXBYT(13,'A1') | HEXBYT(10,'A1');
COUNTRY_NEWLINE_CAR/A100= COUNTRY |CRLF| CAR ;
END

TABLE FILE CAR
PRINT COUNTRY_NEWLINE_CAR 
ON TABLE PCHOLD FORMAT PDF
END


instead of a line break I get some spaces and a square. Maybe that worked with your version 4.3.6, but I do not have this available Wink


WebFOCUS 8.1.0.5 (Server + Client)
Windows 2012 R2
BW, Oracle, Excel, PDF, HTML
January 13, 2017, 04:28 PM
eric.woerle
From the Help File
quote:

Example: Displaying an Alphanumeric Field With Line Breaks in a PDF Report
The following request defines an alphanumeric named ANLB field with a semicolon (in an EDCDIC environment) or a circumflex (in an ASCII environment) in the middle. The CTRAN function then replaces the semicolon or circumflex with a carriage return character and stores this string in a field named ANLBC. On the report output, this field displays on two lines:

DEFINE FILE EMPLOYEE
ANLB/A40 ='THIS IS AN An FIELD;WITH A LINE BREAK.';
ANLBC/A40 = CTRAN(40, ANLB, 094, 013 , ANLBC);
END
TABLE FILE EMPLOYEE
PRINT LAST_NAME ANLBC
WHERE LAST_NAME EQ 'BLACKWOOD'
ON TABLE HOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=REPORT,LINEBREAK='CR',$
ENDSTYLE
END


For PDF you need to define your linebreak character

quote:

Using StyleSheet attributes, you can display An (character) and AnV (varchar) fields that contain line breaks on multiple lines in a PDF or PostScript report. Line breaks can be based on line-feeds, carriage-returns, or a combination of both. If you do not add these StyleSheet attributes, all line-feed and carriage-return formatting within these fields will be ignored, and all characters will be displayed on one line that wraps to fit the width of the report.


--------------------------------------------------------------------------------
Top of page
--------------------------------------------------------------------------------


xx
Syntax: How to Display An and AnV Fields Containing Line Breaks on Multiple Lines
TYPE=REPORT,LINEBREAK='type',$
where:

REPORT
Is the type of report component. TYPE must be REPORT. Otherwise an error will result.
'type'
Specifies that line breaks will be inserted in a report based on the following:
LF inserts a line break after each line-feed character found in all An and AnV fields.

CR inserts a line break after each carriage-return character found in all An and AnV fields.

LFCR inserts a line break after each combination of a line-feed character followed by a carriage-return character found in all An and AnV fields.

CRLF inserts a line break after each combination of a carriage-return character followed by a line-feed character found in all An and AnV fields.

Note: The report output must be formatted as PDF or PostScript.



Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
January 15, 2017, 12:28 PM
WFtESTER
thank you for your help, but I still can't get it to work.

My Example with an html and a fex file.

when debuggin the html output there is clearly a "CRLF" as line brake, but I'm not able to convert it.

any ideas?


WebFOCUS 8.1.0.5 (Server + Client)
Windows 2012 R2
BW, Oracle, Excel, PDF, HTML
January 17, 2017, 09:28 AM
WFtESTER
we could fix it with some javascript code in the html page:

 function parseText(){
 //   alert("test");
    var _txt = document.getElementById("textarea1").value;
    document.getElementById("textarea1").value = _txt.replace(/(?:\r\n|\r|\n)/g,"<br>");
}
 



WebFOCUS 8.1.0.5 (Server + Client)
Windows 2012 R2
BW, Oracle, Excel, PDF, HTML
January 17, 2017, 10:03 AM
susannah
APP PREPENDPATH IBISAMP
DEFINE FILE CAR
CRLF/A2= HEXBYT(13,'A1') | HEXBYT(10,'A1');
COUNTRY_NEWLINE_CAR/A100= COUNTRY |CRLF| CAR ;
END

TABLE FILE CAR
PRINT COUNTRY_NEWLINE_CAR
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
TYPE=REPORT,LINEBREAK='CRLF',$
END
-RUN




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID