3 Replies Latest reply on Nov 9, 2011 5:43 PM by francisjayaraj

    Table alternative fills - issue

    francisjayaraj Level 1

      Untitled-1.jpg

       

       

      I have small doubt regarding the above image

       

      Is there any way to create these alternative table fills in indesign in this method? this one i created manually. i hava large document contains full of tables, my client asking like this.

       

      can anyone help me with this?

        • 1. Re: Table alternative fills - issue
          Steve Werner Adobe Community Professional & MVP

          There's no automatic way to create that pattern in InDesign tables. You'd have to create it manually like you did.

          • 2. Re: Table alternative fills - issue
            [Jongware] Most Valuable Participant

            Alternatively, use this Javascript. Had some fun working around merged cells too (try it!).

             

            var currTable = null;
            if (app.selection.length == 1)
            {
                      currTable = app.selection[0];
                      if (currTable.hasOwnProperty ("baseline"))
                                currTable = currTable.parent;
                      if (currTable instanceof Cell)
                                currTable = currTable.parent;
                      if (currTable instanceof Row)
                                currTable = currTable.parent;
                      if (currTable instanceof Column)
                                currTable = currTable.parent;
                      if (!(currTable instanceof Table))
                      {
                                currTable = null;
                      }
            }
            
            var swatchlist = [];
            for (i=0; i<app.activeDocument.swatches.length; i++)
                      swatchlist.push (app.activeDocument.swatches[i].name);
            
            
            swatchDialog = app.dialogs.add ({name:"Set Alternate Table Fill",canCancel:true});
            with (swatchDialog)
            {
                      with (dialogColumns.add())
                      {
                                with (dialogRows.add())
                                {
                                          staticTexts.add ({staticLabel:"Top left swatch"});
                                          listbox1 = dropdowns.add ({stringList:swatchlist, selectedIndex:0});
                                }
                                with (dialogRows.add())
                                {
                                          staticTexts.add ({staticLabel:"Next swatch"});
                                          listbox2 = dropdowns.add ({stringList:swatchlist, selectedIndex:0});
                                }
                                if (currTable != null)
                                {
                                          with (dialogRows.add())
                                          {
                                                    with (radiobuttonGroups.add())
                                                    {
                                                              justthisone = radiobuttonControls.add({staticLabel:"Just this one table", checkedState:true});
                                                              allofem = radiobuttonControls.add({staticLabel:"All tables", checkedState:false});
                                                    }
                                          }
                                }
                      }
            }
            
            
            if (currTable != null)
            {
                      try {
                                listbox1.selectedIndex = getSwatchIndex(currTable.cells[0].fillColor);
                      } catch (_) { }
                      try {
                                listbox2.selectedIndex = getSwatchIndex(currTable.cells[1].fillColor);
                      } catch (_) { }
            }
            
            
            if (swatchDialog.show())
            {
                      if (justthisone.checkedState == true)
                      {
                                doTable (currTable, app.activeDocument.swatches.item(listbox1.selectedIndex), app.activeDocument.swatches.item(listbox2.selectedIndex) );
                      } else
                      {
                                for (st=0; st<app.activeDocument.stories.length; st++)
                                {
                                          for (ta=0; ta<app.activeDocument.stories[st].tables.length; ta++)
                                          {
                                                    doTable (app.activeDocument.stories[st].tables[ta], app.activeDocument.swatches.item(listbox1.selectedIndex), app.activeDocument.swatches.item(listbox2.selectedIndex));
                                          }
                                }
                      }
            }
            
            
            function getSwatchIndex (swatch)
            {
                      var i;
            
            
                      for (i=0; i<app.activeDocument.swatches.length; i++)
                                if (app.activeDocument.swatches[i] == swatch)
                                          return i;
                      return 0;
            }
            
            
            function doTable (table, swatch1, swatch2)
            {
                      var c;
              
                      for (c=0; c<table.cells.length; c++)
                                table.cells[c].fillColor = ((table.cells[c].parentRow.index ^ table.cells[c].parentColumn.index) & 1) ? swatch2 : swatch1;
            }
            
            
            • 3. Re: Table alternative fills - issue
              francisjayaraj Level 1

              it's really a nice script, its working..............

               

               

              thankyou so much.