• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Table format

Guest
Sep 25, 2012 Sep 25, 2012

Copy link to clipboard

Copied

Hi,

I tried to figure out how to auto format a table; googling around I did a patchwork of script snippets and eventually I came to this:

app.activeDocument.stories.everyItem().tables.everyItem().rows.everyItem().properties = {autoGrow:false};

var doc = app.activeDocument;

var everyStory = doc.stories.everyItem();

var everyTable = everyStory.tables.everyItem();

var allRows = everyTable.rows.everyItem().getElements();

for (var i=1, l=allRows.length; i < l; i++) {

   var row = allRows;

   row.height = "2 cm";

   row.width = "2 cm";

};

Now, this works fine but it seems to affect every row EXCEPT the first one. I have to stress out thatin my table there is no Header row at all.

How is this?

Thank you,

TOPICS
Scripting

Views

674

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 25, 2012 Sep 25, 2012

Copy link to clipboard

Copied

Hi,

JS starts counting 0.

You may shorten it:

var allRows = app.activeDocument.stories.everyItem().tables.everyItem().rows.everyItem().getElements();

l = allRows.length;

for (var i = 0; i <  l; i++) {

   with(allRows){

//set all rowProperties here

   height = "2 cm";

   width = "2 cm";

   autoGrow = false;

}

};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 25, 2012 Sep 25, 2012

Copy link to clipboard

Copied

This is embarassing...

Thank you, hans

g

Il giorno 25/set/2012, alle ore 20:23, -hans- <forums@adobe.com> ha scritto:

var allRows = app.activeDocument.stories.everyItem().tables.everyItem().rows.everyItem().getElements();

l = allRows.length;

for (var i = 0; i < l; i++) {

with(allRows){

//set all rowProperties here

height = "2 cm";

width = "2 cm";

autoGrow = false;

}

};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 25, 2012 Sep 25, 2012

Copy link to clipboard

Copied

LATEST

or without loop:

with(app.activeDocument.stories.everyItem().tables.everyItem().rows.everyItem()){
    autoGrow:false;
  height = "2 cm";
    width = "2 cm";
   }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines