2 Replies Latest reply on Jun 14, 2016 2:47 AM by Andreas Jansson

    Trying to find by format but get unexpected results with overridden style

    Andreas Jansson Level 2

      Under special circumstances, the find/change dialogue finds text despite the fact that they are not matching the format that is entered in the "Find format" section of the same dialogue box.


      To repeat the problem

      1. Download and open my sample document: Simplified copy.idml - Google Drive

      2. Open the Find/Change pane, and either leave the "Find what" field empty, or under the GREP tab, enter this: \d+(:|,)(\d\d|-)

      3. In the "Find format" section, select "Bold SemiCondensed".

      4. Press Find.




      InDesign will now find the text "1,25" despite the fact that it's overridden as just "SemiCondensed" (not BOLD SemiCondensed which we requested).


      The "BF-test" paragraph style does contain "Bold SemiCondensed" in its base, but as we can see in the tooltip, that style is not active, since it's overridden by just "SemiCondensed".

      There is a nested style in the "BF-test" paragraph style, that applies the "Brödtext" character style through the first two tabs. The "Brödtext" character style has "SemiCondensed", but another leading... so I don't see why the tooltip should show SemiCondensed as an override at all here.


      But I can't figure out exactly what's wrong or how to deal with it. Removing the line above the text that is found, removes the problem (the text is not found with the previous line removed... which is the behaviour that I expect). Removing the override (Alt+Click) on the "Test 1,25" line or removing the TAB from the previous line also works to get an "expected" search result (no match).

      Removing the tab character makes the Nested style override on the previous line go away, so somehow that might have something to do with the problem. But now we've got lot's of old documents that looks like this, and we need to deal with that, so I can't just remove all tabs or change the format, since the documents look as they should.


      InDesign CS5, InDesign CS6 and InDesign CC all act the same way.


      This is part of a script, but since the search problem is easily repeatable in the Find/Change-box, I put the question here in the general part of the InDesign forum.


      How can I get this to work? I need to find and deal with "Bold SemiCondensed" texts only... not the ones that are only SemiCondensed like in the example above.




        • 1. Re: Trying to find by format but get unexpected results with overridden style
          Laubender Adobe Community Professional & MVP

          Hi Andreas,

          I can confirm the problem with your document.

          InDesign CS6 v.8.1.0 on Mac OSX 10.7.5
          Tested not much.


          Just one observation:

          I checked all the text in your provided text frame and I found only one single text style range.

          Usually in a constallation like that there should be three text style ranges.


              Result: 1


          I suspect, that the XML tag on the text frame could be the culprit.




          I can see from your IDML, that you exported from CS6: "product="8.0(370)".

          But what is the exact version of InDesign you exported the IDML from?
          What is the history of the document's paragraph styles? InDesign CS3?




          • 2. Re: Trying to find by format but get unexpected results with overridden style
            Andreas Jansson Level 2

            On my computer I opened the document in CS6 (file version, and exported to IDML to get a format that everyone could open here. I've noticed no difference between formats or versions of InDesign, the formats all keep the "error" and the program versions behave the same.


            The styles are most likely created in CS3, and have been upgraded to the user's CS5 (but as said, the IDML has gone through my CS6 as well).


            Removing the XML tag (untagging) makes no difference: the selected "Bold SemiCondensed" criteria is still matching the text that is shown as SemiCondensed.


            The workaround that I've done for the moment is to return a search result in my script, and loop though it, and for each "match" I check that the applied font of the text object found (in variable "f" below) has really got "Bold SemiCondensed" in its name:


            if (f.appliedFont.name.indexOf('Bold SemiCondensed') > -1){



            This way the right font name and style is reported, and I can process only the correct matches.


            Before this I relied on the built-in Find/Replacement methods (the ones in the user interface), and made the replacement by setting app.changeGrepPreferences.changeTo and calling the changeGrep method.


            There are some other places in my script that I have not rewritten, that still relies on this, but they have more complex GREP expressions, so the risk is not high that the font style would be a thing there...

            But nevertheless, this seems to be some kind of bug. Perhaps due to old formats. I don't think I ever managed to recreate a document like this from scratch, even when copying the styles to another document, but that's a couple of weeks ago that I tried to do that. The source of the text is an Excel-import, and after applying a default style the user sets other "leading" properties to make the imported text mass fit better on the pages.