3 Replies Latest reply on Jan 15, 2014 7:10 AM by Jump_Over

    Can I get the currently selected table style from the panel?

    Dan Tate Level 1

      Hi,

       

      I'm looking for a way to get the currently selected table style from the table styles panel, is this something that is possible to do?

       

      I know when I create a table, the table options dialog has a list of table styles and shows the currently selected one as the default choice in the list box, so InDesign must be getting that from somewhere ...

       

      Has anyone found a way to do this?

       

      Thanks,

      Daniel Tate

        • 1. Re: Can I get the currently selected table style from the panel?
          BEGINNER_X Level 3

          Hi Dan,

           

          First select the  single table and use the below code:

           

          alert(app.selection[0].appliedTableStyle.name)
          

           

          If you want the whole document, please use loop.

           

          Regards

          Siraj

          • 2. Re: Can I get the currently selected table style from the panel?
            Dan Tate Level 1

            Hi Siraj,

             

            Thanks for that, but I'm not sure whether that will work with what we're trying to do which is this:

             

            We are dragging something on from one of our own palettes that will be resolved as a table on the page - we'd like to know what the currently selected table style is so that we can automatically set that on the new table for the user, rather than them having to do that.  Does that make sense?

             

            I'm not sure that this is possible!

             

            Alternatively, has anyone set up an event listener on the table style panel to check for when the chosen style has changed?  Is that even possible?

             

            I am surprised that there is not a simple application.selectedTableStyle member available for this, but then there isn't an equivalent for character/paragraph/object style either.

             

            Thanks again,

            Dan

            • 3. Re: Can I get the currently selected table style from the panel?
              Jump_Over Level 5

              Hi,

               

              ...

              We are dragging something on from one of our own palettes

              that will be resolved as a table on the page -

              we'd like to know what the currently selected

              table style is so that we can automatically set that

              on the new table for the user, rather than them having to do that...

               

              if some tableStyle is selected in the panel ==> newTable will be applied with.

              if not ==> newTable.appliedTableStyle.index == 0.

               

              So a solution could be:

              • create a new table
              • read appliedTableStyle.index
              • delete a table

               

              Jarek