1 Reply Latest reply on May 12, 2011 2:07 AM by milligramme

    Change font size of an table with javascript

    moketas

      Hello!

       

      i am new to developing in javascript as well as to indesign. i have to make a few changes to an existing script. in a user dialouge i get the font size in which the imported table should be. but how can i change the font size of an table???

       

      please respond as soon as possible. thanks very much in advance.

       

      moketas

        • 1. Re: Change font size of an table with javascript
          milligramme Level 3

          Hi

          do you want do like this (rightside) ?

          To apply font to each cell, you must access TextFrame => Table => Cell => any TextObject

          tablefont.png

           

          var doc = app.documents[0];
          
          // two textframes, they have a table (2x2)
          var tf_one = doc.textFrames[0];
          var tf_two = doc.textFrames[1];
          
          
          //applied to story
          tf_one.parentStory.appliedFont = "Myriad Pro\tLight";
          tf_one.parentStory.pointSize = 24;
          //not effective against table text
          
          //applied to text-object of each cells of table
          tf_two.parentStory.tables[0].cells.everyItem().texts[0].appliedFont = "Myriad Pro\tBold";
          tf_two.parentStory.tables[0].cells.everyItem().texts[0].pointSize = 24;
          

           

           

           

          thank you

          mg.