Highlighted

table textframe not fit to frame

Community Beginner ,
Jul 27, 2020

Copy link to clipboard

Copied

Hi Everyone,

After updating the content in my table the table content overflows and it need not fit with frame.

See the below code :

 

var table = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().getElements()
for(c=0; c<table.length; c++){
if(table[c].contents.match(/LINKED IMAGES:/)){//Update the Linked Images
table[c+3].contents = "Link Names: \r" + Links;
 
}
table.parentTextFrames.fit(FitOptions.FRAME_TO_CONTENT)
}
Adobe Community Professional
Correct answer by Sunil Yadav | Adobe Community Professional

Try this code snippet:

for(var s = 0; s < app.activeDocument.stories.length; s++){
    var tempStory = app.activeDocument.stories[s];
    for(var t = 0; t < tempStory.tables.length; t++){
        var tempTable = tempStory.tables[t];
        var tempTableFrame = tempTable.cells[0].insertionPoints[0].parentTextFrames[0];
        var cells = tempTable.cells;
        for(var c=0; c < cells.length; c++){
            if(cells[c].contents.match(/LINKED IMAGES:/)){
                cells[c].contents = "Link Names: \r" + Links;
                }
            tempTableFrame.fit(FitOptions.FRAME_TO_CONTENT);
            }
        }
    }

Best

Sunil

TOPICS
Scripting

Views

59

Likes

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

table textframe not fit to frame

Community Beginner ,
Jul 27, 2020

Copy link to clipboard

Copied

Hi Everyone,

After updating the content in my table the table content overflows and it need not fit with frame.

See the below code :

 

var table = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().getElements()
for(c=0; c<table.length; c++){
if(table[c].contents.match(/LINKED IMAGES:/)){//Update the Linked Images
table[c+3].contents = "Link Names: \r" + Links;
 
}
table.parentTextFrames.fit(FitOptions.FRAME_TO_CONTENT)
}
Adobe Community Professional
Correct answer by Sunil Yadav | Adobe Community Professional

Try this code snippet:

for(var s = 0; s < app.activeDocument.stories.length; s++){
    var tempStory = app.activeDocument.stories[s];
    for(var t = 0; t < tempStory.tables.length; t++){
        var tempTable = tempStory.tables[t];
        var tempTableFrame = tempTable.cells[0].insertionPoints[0].parentTextFrames[0];
        var cells = tempTable.cells;
        for(var c=0; c < cells.length; c++){
            if(cells[c].contents.match(/LINKED IMAGES:/)){
                cells[c].contents = "Link Names: \r" + Links;
                }
            tempTableFrame.fit(FitOptions.FRAME_TO_CONTENT);
            }
        }
    }

Best

Sunil

TOPICS
Scripting

Views

60

Likes

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
Jul 27, 2020 0
Adobe Community Professional ,
Oct 10, 2020

Copy link to clipboard

Copied

Try this code snippet:

for(var s = 0; s < app.activeDocument.stories.length; s++){
    var tempStory = app.activeDocument.stories[s];
    for(var t = 0; t < tempStory.tables.length; t++){
        var tempTable = tempStory.tables[t];
        var tempTableFrame = tempTable.cells[0].insertionPoints[0].parentTextFrames[0];
        var cells = tempTable.cells;
        for(var c=0; c < cells.length; c++){
            if(cells[c].contents.match(/LINKED IMAGES:/)){
                cells[c].contents = "Link Names: \r" + Links;
                }
            tempTableFrame.fit(FitOptions.FRAME_TO_CONTENT);
            }
        }
    }

Best

Sunil

Likes

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
Reply
Loading...
Oct 10, 2020 0