2010 Feb 25 8:29 AM
Hi all,
I tried to search this question but found no deserved answer. Please help:
I have a requirement to display data to PDF format, the data is stored in a string. I want to insert a break line between data dynamically but can not.
For e.g.: I have a string:
'This is a test string. I want to break here'
And I expect the output in PDF as:
This is a test string.
I want to break here.
I try to use some constants in CL_ABAP_CHAR_UTILITIES class but it does not work.
Any help will be appreciated.
Thanks,
Khanh
2010 Feb 25 8:33 AM
use
split string at '.' into table itab.
see documentation for split.
2010 Feb 25 8:33 AM
2010 Feb 25 8:36 AM
Hello,
If you are generating the PDF from your SmartForm it will look exactly the same as your SF.
If you use CL_ABAP_CHAR_UTILITIES=>NEWLINE in your SF does this split your text into 2 lines in the SF?
BR,
Suhas
2010 Feb 25 8:43 AM
Hi Suhas,
I tried to used CL_ABAP_CHAR_UTILITIES=>NEWLINE too, it displayed nothing.
@All: I use the string to display into SMARTFORM due to some specific requirement. I do not want to split the string. I would like to insert the line break symbol into that string.
Please suggest.
Thanks,
Khanh
2010 Feb 25 8:58 AM
Hi all,
I did meet the same problem with SAPScript form but can not resolve yet.
In addition, I'm on ECC6.
Thanks,
Khanh
2010 Feb 25 9:25 AM
Hi all,
I close this thread because the answer is CAN NOT.
Please refer to the explanation below: (source: [Expert exchange|http://www.experts-exchange.com/Web_Development/Document_Imaging/Adobe_Acrobat/Q_21149348.html])
OK, you are talking about PDF content.
There is no line break in PDF.
A line break is simulated by advancing the cursor's vertical position by the line distance.
If you read the PDF spec, you will notice that there are not even lines in a PDF file:
All text is organized in "text runs".
A text run can be one character, one word, part of one word, a collection of words, ...
There is no requirement that a text run is one line either.
How text is actually organized depends on the program you use to
create the PDF content - in your case this would be EzPdf,
something I'm not familiar with (not yet :-).
So, you need to look in the EzPdf documentation for information about how to force a line
break.
There is nothing that you can put into the PDF content (that is, if the EzPdf environment is
not filtering the string and forcing the text to a new line behind the scenes) that would
be interpreted as a line break by Acrobat.
What if you put your individual lines (or paragraphs) into separate addTextWrap() calls?
Regards,
Khanh
2013 Dec 19 5:03 PM
Hi guys !
I found the same situation here in a smartform and, I found a way to do that. If you define a table in the smartform, and fill the lines of this table with the text splitted you need, you can print each line of text separately in the Smartform, quite simple.
Thank you for your attention,
Wilson
2016 May 31 9:37 PM
Yes, As mentioned its not possible to Insert a Line Break in a String.
But I solved a similar situation by Populating the string in an internal Table, and Looping through the internal table to print the values. Loop was placed inside a table , to print the Item description which has more than one text lines, with Line break.