June 14, 201114 yr Hello, Text parsing is not one of my strong points! I need to be able to take tagged text and convert it to formatted text and there can be 0 to many tags in one line to multiple paragraphs. The tags are <RD>, </RD> for red text, <B>, </B> for bold, and <I>, </I> for Italic. An example may look like: <RD>This text will be red.</RD> The text in this line will be black. <B>The text here is bold</B> and this text is black again, then <I>this text is italicized.</I> Formatted it would look like: This text will be red. The text in this line will be black. The text here is bold and this text is black again, then this text is italicized. Any ideas on how to process this would be greatly appreciated, TIA, John
June 14, 201114 yr Try = Let ( [ formula = Substitute ( "" & Quote ( text ) & "" ; [ "<RD>" ; Quote ( " & TextColor ( " ) ] ; [ "</RD>" ; Quote ( " ; 16646400 ) & " ) ] ; [ "<B>" ; Quote ( " & TextStyleAdd ( " ) ] ; [ "</B>" ; Quote ( " ; bold ) & " ) ] ; [ "<I>" ; Quote ( " & TextStyleAdd ( " ) ] ; [ "</I>" ; Quote ( " ; italic ) & " ) ] ) ] ; Evaluate ( formula ) )
June 15, 201114 yr Author This works fantastic, thank you! I was thinking of something far more complex than this! I definitely need to spend time with the "Let" and "Evaluate" functions! Thanks again. John Try = Let ( [ formula = Substitute ( "" & Quote ( text ) & "" ; [ "<RD>" ; Quote ( " & TextColor ( " ) ] ; [ "</RD>" ; Quote ( " ; 16646400 ) & " ) ] ; [ "<B>" ; Quote ( " & TextStyleAdd ( " ) ] ; [ "</B>" ; Quote ( " ; bold ) & " ) ] ; [ "<I>" ; Quote ( " & TextStyleAdd ( " ) ] ; [ "</I>" ; Quote ( " ; italic ) & " ) ] ) ] ; Evaluate ( formula ) )
Create an account or sign in to comment