Returns one or more lines of text in the text object as a list of strings, with line endings as displayed in the application.
GetMultiText returns each line of text as it is currently displayed in the application. This method returns different values if the text rewraps when you resize the window.
Calling GetMultiText with no arguments returns all lines of text in the text object.
Each line returned by GetMultiText can contain up to 1023 characters.
GetMultiText does not remove any blank lines within the selected text. If no text is selected, the function returns an empty list. You can set the OPT_GET_MULTITEXT_KEEP_EMPTY_LINES agent option to FALSE to remove empty lines within the selected text.
GetMultiText applies to the <textarea> element. To see an example that applies to any element and does not have the same size limitation, see the following workaround.
This example uses the description of sunglasses on the Products page of the GMO Web application.
LIST OF STRING lsText lsText = ProductsPage.SunGlassesDesc.GetMultiText() ListPrint(lsText) // Result: // Use these full-coverage, full-protection sun glasses for all your outdoor // activities. Polycarbonate lenses provide lightweight, shatterproof // protection. Lenses offer 100% UV protection; gray tint for true color // transmission. Coating on inside of lens decreases light reflections from // behind. Wire-injected nylon frames are unbreakable and offer a snug, sure // fit.
You can use ExecMethod() to return a single string, as the following code shows:
[ ] STRING s = HtmlText("Very long text*").ExecMethod("innerText")
If, on the other hand, you want to return what you would expect GetMultiText() to return, parse the string at the carriage return/line feed (CR/LF) boundaries:
[] INTEGER iPos = 1 [] LIST OF STRING lsMulti = {} [-] while iPos > 0 [] iPos = StrPos(Chr(13) + Chr(10), s) [-] if iPos > 0 [] ListAppend(lsMulti, Left(s, iPos - 1)) [] s = SubStr(s, iPos + 2) [-] else [] ListAppend(lsMulti, s)