2 Replies Latest reply on Jul 21, 2008 3:01 AM by (Lee_Fielding)

    [CS3 JS] How to change a Substr of findTextpreferences?

      Hello wise ones,

      I have a situation where I'd like to reformat the position to Superscript of only a section (substr) from a 'findTextPreferences'!

      At the moment I have the following code to replace all Registered Trademarks within my document:
      >app.findTextPreferences = null;

      app.changeTextPreferences = null;
      //
      app.findChangeTextOptions.includeMasterPages = true;
      app.findChangeTextOptions.caseSensitive = true;
      app.findChangeTextOptions.wholeWord = false;
      //
      app.findTextPreferences.findWhat = "®";
      app.changeTextPreferences.position = Position.superscript;
      app.documents.item(0).changeText();

      This works fine. It reformats all instances of '®' to Superscript.
      ie; 'OMEGA®' will be reformated to display the ® in Superscript.

      i BUT NOW . . . .

      I have a sticky situation where I'd like to reformat all occurances of '
      b IT
      ' FROM THE WORD '
      b OperateIT
      ' into superscript!
      It would be simple to say:
      > app.findTextPreferences.findWhat = "IT";

      app.changeTextPreferences.position = Position.superscript;
      app.documents.item(0).changeText();

      BUT - I also have the term '
      b IIT800M
      ' within my document and the above coding also reformats this title - which is not wanted!

      I ONLY need the 'IT' from 'OperateIT' to be reformated - how should I go about tackeling this?
      I feel it would be something with 'substr'...? But how?

      Can anyone point me in the right direction?
      Thanks in advance,
      Lee