February 4, 20196 yr Hi, Using TextStyleAdd, I want to change the style of a single letter at the beginning of a sentence. For example: // SOAP [ "S:" ; TextStyleAdd ( "S:" ; Bold ) ] ; [ "O:" ; TextStyleAdd ( "O:" ; Bold ) ] ; [ "A:" ; TextStyleAdd ( "A:" ; Bold ) ] ; [ "P:" ; TextStyleAdd ( "P:" ; Bold ) ] ; But I get this: P: - P: (correct) SOAP: - SOAP: (incorrect) SOFA: - SOFA: (incorrect) Is there a way of adding search constraints to TextStyleAdd? Or, is there a hidden character at the beginning of each line I can capture? All the very best, Daniel
February 4, 20196 yr HOPE i am giving you what u asked for 1ST LETTER BOLD.fmp12 version 2 1ST LETTER v2.fmp12 Edited February 4, 20196 yr by Dr.Gopala krishnam raju AMBATI my first help in this community :)
February 4, 20196 yr 3 hours ago, Quito said: a single letter at the beginning of a sentence It depends on how you define a "sentence". If it's just the first letter of the entire field, then it's simple: isolate it using the Left() function and apply the style; then output the rest, using the Right() function. No substitution is required for this. If it's something else, then it gets interesting.
February 5, 20196 yr Author 20 hours ago, comment said: It depends on how you define a "sentence". If it's just the first letter of the entire field, then it's simple: isolate it using the Left() function and apply the style; then output the rest, using the Right() function. No substitution is required for this. If it's something else, then it gets interesting. Thank you Gopala and Comment, Basically, I would like to style certain words or phrases in a text field. I want to style whole words only. Selecting the phrase by adding delimiters (space, comma, dot, semicolon, apostrophe, etc) is simple and works fine. The problem is isolating single letter words followed by a colon, such as: S: O: A: P: Because TextStyleAdd doesn't search for whole words, I end up with words ending in S: O: A: P: also being styled (See attached file). So, the script should do something like: If there is a whole word, formed by a single letter (any of these four letters S, O, A or P), at the beginning of the field, followed by a colon, make it Bold Hope this helps. All the very best, Daniel
February 5, 20196 yr 2 hours ago, Quito said: If there is a whole word, formed by a single letter (any of these four letters S, O, A or P), at the beginning of the field, followed by a colon, make it Bold Then how about = Substitute ( "§" & Yourfield ; [ "§S:" ; TextStyleAdd ( "S:" ; Bold ) ] ; [ "§O:" ; TextStyleAdd ( "O:" ; Bold ) ] ; [ "§A:" ; TextStyleAdd ( "A:" ; Bold ) ] ; [ "§P:" ; TextStyleAdd ( "P:" ; Bold ) ] ; [ "§" ; "" ] ) You can use any character that you know is not going to be used in the field. I usually use Char ( 6320 ) which is an unassigned Unicode code point, but "§" is easier to use and to read.
Create an account or sign in to comment