Hello, All!

I tried posting this behavior to the VFP bug report page, but I get a Page
Unavailable error. I think this is a bug. If you can confirm this, perhaps
Lee or one of the MVP's who hang out here can forward it to the right
people.

I am using the TEXTMERGE functions to merge memvars with preformatted RTF
text that is stored in a table. If the RTF contains one or more spaces
followed by a CHR(13), then the spaces are removed. To demonstrate this
behavior, try this code. Note, I did not include any variables to merge with
the text.

<vfp_code>
lcTest = "Here are 10 spaces:" + SPACE(10) + CHR(13) + "This is the second
line."
set textmerge to test.txt
set textmerge on
\\<<lcTest>>
set textmerge to
c = filetostr("test.txt")
?SPACE(10)$c && .F.
</vfp_code>

I was able to fix this issue by replacing spaces prior to using the
textmerge features, but I find it a bit quick and dirty:
<vfp_code>
lcTest = "Here are 10 spaces:" + SPACE(10) + CHR(13) + "This is the second
line."
lcTest = STRTRAN(lcTest, " ", "!@#$QUICKANDDIRTYFIX")
set textmerge to test.txt
set textmerge on
\\<<lcTest>>
set textmerge to
* now lets hope the replacement string does not exist in the preformatted
RTF....
* otherwise use a function like SYS(2015).
c = STRTRAN(filetostr("test.txt"), "!@#$QUICKANDDIRTYFIX", " ")
?SPACE(10)$c && .T.
</vfp_code>

So what do you think: is this behavior by design?
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8

Re: VFP6&7&8: possible bug with TEXTMERGE by George

George
Wed Jul 30 20:58:02 CDT 2003

that was a stupid move :-D
one slash does the new line, no need to <<CHR(13)>>

FOR i=1 TO nLines
\<<rtfLines[i]>>
ENDFOR

;-)

"George Nava" <NavaGeorge@Hotmail.com> wrote in message
news:e7$p5YwVDHA.2896@tk2msftngp13.phx.gbl...
> line1 = "Test"+SPACE(10)+CHR(13)
> line2 = "Test"+SPACE(10)+CHR(13)+"Test2"
>
> line1 does not cause a problem but line 2 does
>
> Anyway, another approach would be to split the rtf with ALINES and loop
'em
>
> lcTest = "Here are 10 spaces:" + SPACE(10) + CHR(13) + "This is the second
> line."
> nLines = ALINES(rtfLines,lcTest,.F.)
> SET TEXTMERGE ON TO MEMVAR myVar NOSHOW
> FOR i=1 TO nLines
> \\<<rtfLines[i]>><<CHR(13)>>
> ENDFOR
> SET TEXTMERGE TO
> ? myVar
> ? SPACE(10)$myVar
> ? "|" + rtfLines[1] + "|"
>
>
> "Eric den Doop" <ericdendoop@xspamblockxfoxite.com> wrote in message
> news:OEGil3tVDHA.3404@tk2msftngp13.phx.gbl...
> > Hello, All!
> >
> > I tried posting this behavior to the VFP bug report page, but I get a
Page
> > Unavailable error. I think this is a bug. If you can confirm this,
perhaps
> > Lee or one of the MVP's who hang out here can forward it to the right
> > people.
> >
> > I am using the TEXTMERGE functions to merge memvars with preformatted
RTF
> > text that is stored in a table. If the RTF contains one or more spaces
> > followed by a CHR(13), then the spaces are removed. To demonstrate this
> > behavior, try this code. Note, I did not include any variables to merge
> with
> > the text.
> >
> > <vfp_code>
> > lcTest = "Here are 10 spaces:" + SPACE(10) + CHR(13) + "This is the
second
> > line."
> > set textmerge to test.txt
> > set textmerge on
> > \\<<lcTest>>
> > set textmerge to
> > c = filetostr("test.txt")
> > ?SPACE(10)$c && .F.
> > </vfp_code>
> >
> > I was able to fix this issue by replacing spaces prior to using the
> > textmerge features, but I find it a bit quick and dirty:
> > <vfp_code>
> > lcTest = "Here are 10 spaces:" + SPACE(10) + CHR(13) + "This is the
second
> > line."
> > lcTest = STRTRAN(lcTest, " ", "!@#$QUICKANDDIRTYFIX")
> > set textmerge to test.txt
> > set textmerge on
> > \\<<lcTest>>
> > set textmerge to
> > * now lets hope the replacement string does not exist in the
preformatted
> > RTF....
> > * otherwise use a function like SYS(2015).
> > c = STRTRAN(filetostr("test.txt"), "!@#$QUICKANDDIRTYFIX", " ")
> > ?SPACE(10)$c && .T.
> > </vfp_code>
> >
> > So what do you think: is this behavior by design?
> > --
> > Eric den Doop
> > www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8
> >
> >
>
>



Re: VFP6&7&8: possible bug with TEXTMERGE by Josh

Josh
Thu Jul 31 08:34:06 CDT 2003


I think it's by design...
it's just trimming off trailing spaces.

On Wed, 30 Jul 2003 23:02:28 +0200, "Eric den Doop"
<ericdendoop@xspamblockxfoxite.com> wrote:

>Hello, All!
>
>I tried posting this behavior to the VFP bug report page, but I get a Page
>Unavailable error. I think this is a bug. If you can confirm this, perhaps
>Lee or one of the MVP's who hang out here can forward it to the right
>people.
>
>I am using the TEXTMERGE functions to merge memvars with preformatted RTF
>text that is stored in a table. If the RTF contains one or more spaces
>followed by a CHR(13), then the spaces are removed. To demonstrate this
>behavior, try this code. Note, I did not include any variables to merge with
>the text.
>
><vfp_code>
>lcTest = "Here are 10 spaces:" + SPACE(10) + CHR(13) + "This is the second
>line."
>set textmerge to test.txt
>set textmerge on
>\\<<lcTest>>
>set textmerge to
>c = filetostr("test.txt")
>?SPACE(10)$c && .F.
></vfp_code>
>
>I was able to fix this issue by replacing spaces prior to using the
>textmerge features, but I find it a bit quick and dirty:
><vfp_code>
>lcTest = "Here are 10 spaces:" + SPACE(10) + CHR(13) + "This is the second
>line."
>lcTest = STRTRAN(lcTest, " ", "!@#$QUICKANDDIRTYFIX")
>set textmerge to test.txt
>set textmerge on
>\\<<lcTest>>
>set textmerge to
>* now lets hope the replacement string does not exist in the preformatted
>RTF....
>* otherwise use a function like SYS(2015).
>c = STRTRAN(filetostr("test.txt"), "!@#$QUICKANDDIRTYFIX", " ")
>?SPACE(10)$c && .T.
></vfp_code>
>
>So what do you think: is this behavior by design?