0 Replies Latest reply on Dec 9, 2010 7:31 AM by albanx

    TextStyleRange on content change removes style

    albanx

      HEllo

      I am tryning to change  text of a textframe by changing the single styleRanges of the  textFrame. My textFrame has 4 styleRanges but when i change the text of  the first StyleRange , the textFrames counts 3 styleRanges. Why it  removes style ranges? Here is the code i try on Extende Script editor:

      var box=layer.textFrames[2];

      var styles=box.textStyleRanges;//styles.length=4

       

      var s1=styles[0].contents;//ok
      var s2=styles[1].contents;//ok
      var s3=styles[2].contents;//ok
      var s4=styles[3].contents;//ok
      */
      var s1=styles[0].contents="somtext\rsomtext\rsomtext (somtext)\r";//this change merges styles[0]  and styles[1] in one

       

      var styles=box.textStyleRanges;//styles.length=3
      var s1=styles[0].contents;//ok
      var s2=styles[1].contents;//ok
      var s3=styles[2].contents;//ok
      var s4=styles[3].contents;//error dont exists

       

      It seems that the change of the text  merge styleRange1 and styleRange2. Any one know why??? Any help?

      Thanks