ap2203
16th November 2009, 20:20
Hello
I have a problem when I want to write text from item in excel
text has more lines, I want to download to excel like in text editor ,like I put on report, but I define a domain for report as tctxtn, all is OK, I see line for line like in text editor, but When i put in excel file is not OK
(I have correct number of text and found text ) but I dont know how corrrect write more text linies in excel ( line per line )
( I make excel file from report )
Have any function or something for text when I want write in excel like in text editor
any suggestion
thanks
rberti
16th November 2009, 22:45
maybe you colud use text.to.buf() function, read and print line per line of the text field as a simple string field.
Hope it helps.
Rafael
ranjankool
17th November 2009, 11:39
Hi,
I was also getting same problem. My requirement was to print "Remark Text" which is on Form. I have taken txtn field as form field not table but i couldn't print text.
I was trying with following text: -
long no.of.lines.to.use, txtl.len, retval
domain tgwms.txtl textline.string(1) | internal storage of text
r.amnt = 0
txtl.len = tgbrg0007.domain.string.length("tgwms.txtl")
if text.present.in.language(r.remark, language$, no.of.lines.to.use) <> 1 then
r.text = ""
else
retval = alloc.mem(textline.string, txtl.len, no.of.lines.to.use)
retval = text.to.buf("r.remark", language$, no.of.lines.to.use,textline.string)
if no.of.lines.to.use > 0 then
r.text = textline.string(1,1;60)
else
r.text = ""
endif
endif
Here "text.present.in.language" should return 1 for text to be printed, but its not.
If You have any solution for this please reply.
mark_h
17th November 2009, 15:56
What is in language$? Validate the text is in that language in tttxt010. If it is you may want to try hardcoding the language with something like "2" and see if that works.
ap2203
17th November 2009, 19:56
Thanks for help
Here is my code (to better understand my problem )
I read tipcs023, founf number of text and read tttxt010 for text, and found them , but then I have a problem
function read.txt010()
{
k=0 p=0 s=0 tekst1="" lengt=0
select tttxt010.*
from tttxt010
where tttxt010.ctxt =:tipcs023.txta
order by tttxt010.ctxt
selectdo
|cit.txt002()
tekst =tttxt010.text |HERE IS PROBLEM
tekst1=tttxt010.text
lengt = len(strip$(tttxt010.text))
for i = 1 to (lengt + 1)
if i=1
then k=1 p=0
endif
s=asc(tekst1(i;1))
if asc(tekst1(i;1)) = 10 or asc(tekst1(i;1)) = 13 then
p=i-k
tekst=tttxt010.text(k;p)
K=i+1
write.det()
endif
|if asc(instr(i;1)) = 0 then |null
| BREAK
|endif
|if asc(instr(i;1)) = 32 then |space
| p = i
|endif
|if asc(instr(i;1)) = 13 then |CR
| j = 1
|endif
|if asc(instr(i;1)) = 10 then |Line Feed
| j = 1
|endif
endfor
selectempty
tekst=" " tekst1=" "
write.det()
endselect
I found text group, and erite in report with domain tctxtn, but I want download to excel like in report line by line like in text editor,
I put it but not like I want, I dont know domain which i must define to download to excel i take a string but is not ok
I ll try with text.to.buff() how i can devide line by line
Best regards
ap2203
17th November 2009, 19:58
I forgot
Any sampl code which works OK
Thanks
bdittmar
18th November 2009, 18:03
I forgot
Any sampl code which works OK
Thanks
Hello,
as rberty suggest, use text.to.buf() like :
function read.description.text()
{
|Bemerkungstext ist Feld dhsma050.txtb
bemerkung1 = ""
string btext(500)
string bbuf(80,40)
long b
btext = ""
for b = 1 to
text.to.buf("dhsma050.txtb", "3", 2, bbuf)
btext = strip$(btext)&" "&strip$(bbuf(1,b))
endfor
bemerkung1 = btext
}
Regards