Page 1 of 1

Making Text Bold when you only know part of the text

PostPosted: Tue Apr 29, 2008 6:58 am
by jim shelton
If I will not know a complete phrase ahead of time only part of the wording, how can I make the complete phrase bold.

Example of text:

"Amount Received Via" Visa endinging in XXXX dated 4/08/2008.

The portion in quotes and the year is the only known segment.

Text in this field that does not start with Amount Received, will remain plain.

Is there a way to define text like : "Amount Received Via ..... 2008" so that anything beginning and ending would be caught.

thanks,

Jim

PostPosted: Wed Apr 30, 2008 6:04 am
by John Sindelar
How about the following, just change "n" to be the field containing your block of text, and change "start" and "end" to be the pieces of the text you know and want to contain the bold section:

Code: Select all
Let ( [
n = "Here is some text. Amount Received Via Visa endinging in XXXX dated 4/08/2008. And here is some more text" ;
start = "Amount Received Via" ;
end = "2008." ;
string = Middle ( n ; Position ( n ; start ; 1 ; 1 ) ; Position ( n ; end ; 1 ; 1 ) + Length ( end )- 1 - Position ( n ; start ; 1 ; 1 ) )
] ;

Replace ( n ; Position ( n ; start ; 1 ; 1 ) ; Length ( string )  ; TextStyleAdd ( string ; Bold ) )

)


Returns: Here is some text. Amount Received Via Visa endinging in XXXX dated 4/08/2008. And here is some more text