3 Replies Latest reply on Apr 15, 2010 12:11 AM by Coully

    Change Text Preferences

    Coully

      Hello

       

      I have a method which changes some text in a text frame But I only wish to change the first instance it finds. At the moment it changes all finds.

       

      Is there a Prefernce setting ChangeTextPreference.ButJustTheFirstOneMatey

       

      or equivalent?

       

      Many Thanks

       

      Mark.

       

      Please ignore the C# and 'pretend' it's javascript.

       

                     private void ChangeTextFrameText(Document doc, TextFrame TargetTextFrame, string ChangeText, string ChangeTo)

                      {

       

                          Application IndesignApp = (Application)doc.Parent;

                          IndesignApp.FindTextPreferences = idNothingEnum.idNothing;

                          IndesignApp.ChangeTextPreferences = idNothingEnum.idNothing;

       

                          FindTextPreference FTP = (FindTextPreference)IndesignApp.FindTextPreferences;

                          FTP.FindWhat = ChangeText;

       

                          ChangeTextPreference CTP = (ChangeTextPreference)IndesignApp.ChangeTextPreferences;

                          CTP.ChangeTo = ChangeTo;

       

                          FindChangeTextOption FCTO = (FindChangeTextOption)IndesignApp.FindChangeTextOptions;

       

                          FCTO.CaseSensitive = false;

                          FCTO.IncludeFootnotes = false;

                          FCTO.IncludeHiddenLayers = false;

                          FCTO.IncludeLockedLayersForFind = false;

                          FCTO.IncludeLockedStoriesForFind = false;

                          FCTO.IncludeMasterPages = false;

                          FCTO.WholeWord = false;

       

                          Objects O = TargetTextFrame.ParentStory.ChangeText(false);

                          IndesignApp.FindTextPreferences = idNothingEnum.idNothing;

                          IndesignApp.ChangeTextPreferences = idNothingEnum.idNothing;

       

                }