3 Replies Latest reply on Dec 25, 2014 10:00 AM by pixxxel schubser

    Make a script for build table

    Teetan VK Level 1

      Hi everyone

       

      How to make a script for build table:

       

      col width 25mm

      align decimal

      align on close paren

       

      Thanks

       

      Teetan

        • 1. Re: Make a script for build table
          pixxxel schubser Level 5

          Hi Teetan VK,

          Merry Chrismas.

           

          I'm not really an InDesign scripter.

          But you can try the following code:

          // TableCreate_simple.jsx
          // regards pixxxelschubser
          
          var aDoc = app.activeDocument;
          
          // your width of every column
          var w = Number(prompt("width of columns", 25));
          var NrOfColumns = 3;
          var aTextFrame = aDoc.textFrames.add({visibleBounds:[0, 0, 30, NrOfColumns*w + 1]});
          var aTable = aTextFrame.insertionPoints[0].tables.add({columnCount:NrOfColumns,bodyRowCount:1});
          
          for (i=0; i<aTable.columns.length; i++) {
          aTable.columns[i].width = w;
          }
          
          // Paragraph sytyle with decimal aligning should already exists in your document
          for (j = 0; j < aTable.cells.length; j++) {
              aTable.cells[j].texts[0].appliedParagraphStyle = aDoc.paragraphStyles.item("AlignDecimal");
          }
          

           

          Be sure, that a paragraph style (named with "AlignDecimal") exists in your Document.

           

           

          --------------------------------

           

          But what is:

          Teetan VK schrieb:

           

          … align on close paren …

           

          • 2. Re: Make a script for build table
            Teetan VK Level 1

            Hi Pixxel

             

            thank you for your response

             

            the align with decimal and align on close paren like this:

             

            2.jpg

             

            thank you so much

             

            Teetan

            • 3. Re: Make a script for build table
              pixxxel schubser Level 5

              Create a paragraph style with decimal and align on close paren (named with AlignDecimal) and run the script.


              Have fun