pellus
18th June 2014, 15:07
Hello, I have a text problem. LN fp7.
A text is sometimes formatted with RTF by the user . I get problems to get hold of the text content, for example to use in an xml-file?

Example:
We have 10 lines (with RTF-formatting) of which the last is "Thankyou and good night". Looks fine when looking at it in LN text editor.
I do a text.to.buf. In the receiving Array, occurence 10, I see only "Tha". All before is fine. But "Tha" is the last I get.
I read the tttxt010 directly. After the last Control characters in the last record, there is only "Tha"

So how can I get the all textlines, all 10 lines uncorrupted, to use.

There is a specific flag for rtf in text.to.buf -command but when I use this I get some unreadable data which I can not use.

bdittmar
18th June 2014, 15:52
Hello, I have a text problem. LN fp7.
A text is sometimes formatted with RTF by the user . I get problems to get hold of the text content, for example to use in an xml-file?

Example:
We have 10 lines (with RTF-formatting) of which the last is "Thankyou and good night". Looks fine when looking at it in LN text editor.
I do a text.to.buf. In the receiving Array, occurence 10, I see only "Tha". All before is fine. But "Tha" is the last I get.
I read the tttxt010 directly. After the last Control characters in the last record, there is only "Tha"

So how can I get the all textlines, all 10 lines uncorrupted, to use.

There is a specific flag for rtf in text.to.buf -command but when I use this I get some unreadable data which I can not use.

Hello,

for it seems like "buf" maybe to small ?

text.to.buf()
Syntax:

function long text.to.buf (string text_field, string lang, long nr_lines, ref string buf [, long rtf.text])

Description


This stores the text of a specified text field in a two-dimensional string array.


Arguments

string text_field The name of the text field that must be retrieved. See Text fields overview.

string lang This specifies the relevant language.

long nr_lines This specifies the maximum number of lines that can be stored in the buffer.

ref string buf This specifies the buffer in which the text must be stored.

[long rtf.text ] Set this argument to true if you want the text to be stored in RTF format instead of ASCII format. This is possible only when using a text group that supports RTF data.


Return values

>0 number of stored lines

0 error

- 1 no permission to store the text

Check :

Change Thankyou and good night to to something like 1234567890........ and if your Output is 123 the buffer is too small.

Regards

pellus
19th June 2014, 10:55
Thankyou Bernd, bigger buffer solved it.