Jump to content

Replacing Tokens In Stylized Text


This topic is 7212 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello,

I have a problem I'm hoping someone has a solution for with FileMaker 6.

Essentially I'm trying to implement a mail merge type situation where an editable text field contains tokens/markers that later get replaced with other field values from the database.

This editable field contains text of varying styles (some bold, underline, centered, etc.). If I use the Substitute() function:


Insert Calculated Result[select, "fTextField", Substitute(GetField("fTextField"), "%TOKEN1%", GetField("fToken1"))"]

the markers are replaced as expected BUT I lose all of the styled text.

I'm looking for a cross-platform solution (it HAS to run on Mac and Win) that could work in FM 6, with or without plug-ins. I know this all works fine in FM 7 but I'm trying to avoid migrating to FM 7 at the same time unless I have absolutely no other choice.

Ideas anyone?

Link to comment
Share on other sites

The Find/Replace function in FMP 6 preserves character formatting. It can be used to merge codes instead of using the Substitute() function. You'll need to copy/paste the template text into a field, then run the Replace script over the text to merge it.

Both of these processes are layout dependent (the fields need to be on the current layout when the copy/paste and Replace steps run).

Link to comment
Share on other sites

Hi Vaughan,

Thanks for the tip. Unfortunately that doesn't get me all the way there as the Copy/Paste script steps blow away the 'centered' formatting on some of the text in the field (the bold, underline, etc. styles come across fine however). The Find/Replace part does work as expected.

Oh well. *So* close. I guess it's on to FM 7...

Link to comment
Share on other sites

This topic is 7212 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.