Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Re: columns.redistribute

$
0
0

So you must have a table with only one column in it in the top row.

Anyway this should deal with MOST cases and only does a very little bit of write iterating so should still be very quick

 

 

// Script by Trevor  http://forums.adobe.com/message/5225003#5225003
app.doScript("main()", ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Table Redistribution");
function main(){    var  myOneRowTables = [],            n = 0,            mt = app.documents[0].stories.everyItem().tables.everyItem().getElements(), l = mt.length;            myTables = app.documents[0].stories.everyItem().tables.everyItem();    while (l--) if (mt[l].rows[0].cells.length < 2 && mt[l].rows.length > 1)         {            myOneRowTables [n++] = mt[l];            mt[l].rows[0].cells[0].split (HorizontalOrVertical.VERTICAL);         }    myTables.rows[0].redistribute(HorizontalOrVertical.VERTICAL); // changed from columns[0] to row[0] and got rid of the range    while (n--)         {            myOneRowTables[n].rows[0].cells[0].merge (myOneRowTables[n].rows[0].cells[1])            myOneRowTables[n].rows.itemByRange(1,-1).redistribute(HorizontalOrVertical.VERTICAL);        }}

Viewing all articles
Browse latest Browse all 37788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>