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

table textframe not fit to frame

Contributor ,
Jul 27, 2020 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)
}
TOPICS
Scripting

Views

232

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

correct answers 1 Correct answer

Advocate , Oct 10, 2020 Oct 10, 2020

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 = "L
...

Votes

Translate

Translate
Advocate ,
Oct 10, 2020 Oct 10, 2020

Copy link to clipboard

Copied

LATEST

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

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