10 Replies Latest reply on Sep 22, 2011 4:19 AM by andreasf

    applyParagraphStyle Doesn't Clear Overrides

    Zoffix222 Level 1



      In the Adobe InDesign CS5.5 Scripting Guide, there's a paragraph that reads:


      Why use the applyParagraphStyle method instead of setting the appliedParagraphStyle property of

      the text object? The applyParagraphStyle method gives the ability to override existing formatting;

      setting the property to a style retains local formatting.


      However, when I use applyParagraphStyle like this: text_frame.parentStory.paragraphs[0].applyParagraphStyle(title_style, true);  the color and font family of the paragraph is not changed (even though the size is).


      Am I missing something? Here's the full code I'm using:


      var products = load_products();
      var doc = app.documents.add();
      var title_style = doc.paragraphStyles.item('Product - Title');
      for ( var i = 0, l = products.length; i < l; i++ ) {
          var text_frame = doc.pages[0].textFrames.add();
          text_frame.geometricBounds = [
              (100 * i) + 'pt',
              (100 * i + 240) + 'pt',
          text_frame.contents = products[i].title;
          text_frame.parentStory.paragraphs[0].applyParagraphStyle(title_style, true);
          var b = text_frame.geometricBounds;


      Edit: if after ruinning the script I go to apply the style to this paragraph, I get an option in the context menu to clear overrides; and if I do so, then the color and font-family are changed.


      Message was edited by: Zoffix222