Mike,

This is more than just a forum. This is really a place where people help people.

I must say that R:base has been so far a heart-warming experience.

Thank you.
I will try the code immediately.

Too hot to go to sleep over here.

Luc Delcoigne

--------------------------------------------------
From: "Mike Byerley" <[email protected]>
Sent: Thursday, July 08, 2010 10:25 PM
To: "RBASE-L Mailing List" <[email protected]>
Subject: [RBASE-L] - re: inserting text in ascii file.

Is the problem that after you have it (the file) converted to a Text variable (is it TEXT or VARCHAR), that the word wrap is beyond 75 characters?

If it is, I have some old rbase code that wraps text at a designated maximum width. Also, after you get the DLL, you will be able to process text files any way that is permitted within the VBScript Language.

The RBASE CODE:

{begin code}
LABEL bgprog


 SET VAR vnote NOTE = (.vVariableOfMyTextFileContents)

 CLEAR VAR v1,v2,v3,v4,v5,v6,v7,v8
 SET VAR vstrtmp NOTE
 SET VAR vgetlen INTEGER
 SET VAR vgettext TEXT
 SET VAR vstrlen INTEGER
 --the wrap location

 SET VAR vwrap INTEGER = 75
 SET VAR vcrlf = ((CHAR(13))+(CHAR(10)))
 SET VAR vstrlen = (SLEN(.vnote))
 WHILE vstrlen > 0 THEN
   SET VAR vsloc = .vwrap
   --test for location of space at wrap point
   IF (SGET(.vnote,1,.vwrap)) <> ' ' THEN
     -- loop backwards till find set var vgetlen = .vsloc
     WHILE (SGET(.vnote,1,.vsloc)) <> ' ' THEN
       IF (SLEN(.vnote)) <= .vsloc THEN
         SET VAR vsloc = (SLEN(.vnote))
         SET VAR vgetlen = (SLEN(.vnote))
       ELSE
         SET VAR vsloc = (.vsloc - 1)
         SET VAR vgetlen = .vsloc
       ENDIF
     ENDWHILE
     SET VAR vgettext = (SGET(.vnote,.vgetlen,1))
     SET VAR vgettext = (LJS(.vgettext,.vgetlen))
     SET VAR vgettext = (STRIM(.vgettext))
     SET VAR vstrtmp = (.vstrtmp + .vgettext + .vcrlf)
     SET VAR vstrlen = (.vstrlen - .vgetlen)
     IF vstrlen < 0 THEN
       SET VAR vstrlen = (SLEN(.vnote))
     ENDIF
     SET VAR vnote = (SGET(.vnote,.vstrlen, (.vgetlen + 1)))
   ELSE
     SET VAR vgettext = (SGET(.vnote,.vwrap,1))
     SET VAR vgettext = (LJS(.vgettext,.vwrap))
     SET VAR vgettext = (STRIM(.vgettext))
     SET VAR vstrtmp = (.vstrtmp + .vgettext + .vcrlf)
     SET VAR vstrlen = (.vstrlen - .vwrap)
     IF vstrlen < 0 THEN
       SET VAR vstrlen = (SLEN(.vnote))
     ENDIF
     SET VAR vnote = (SGET(.vnote, .vstrlen, (.vwrap + 1)))
   ENDIF
 ENDWHILE
 SET VAR vnote = (SRPL(.vstrtmp,'  ', ' ',0))
LABEL ndproc
 show var vnote=.vwrap at 5 20
 CLEAR VAR vcrlf,vgetlen,vgettext,vsloc,vstrlen,vstrtmp,vwrap
 RETURN

{end code}

----- Original Message ----- From: "Luc Delcoigne" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Thursday, July 08, 2010 4:09 PM
Subject: [RBASE-L] - re: inserting text in ascii file.


Hi all,

I've been sweating all day long on this problem.

In a ascii file I have to insert the contents of a rtf- blob.
With the RRTFtoTxt pluging I could convert the it to a text variable.

Now I can insert the text variable in my file.

BUT the lines of the inserted text cannot be longer than 75 characters.

This is an essential part of my application.

Without this I could be forced to stick with Access where I can manipulate the file with the Wordobj....and I love R:base...

Any ideas ??
Grtz

Luc Delcoigne



Reply via email to