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

May i resize table, which right edge standing out of page/frame border

New Here ,
Apr 15, 2008 Apr 15, 2008

Copy link to clipboard

Copied

After pasting big table, its right edge is commonly outside of story frame. To resize the table we use cursor+shift key and slide right border to adjust a frame edge. Can we do it by script?

b Thanks.
TOPICS
Scripting

Views

297

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
Community Expert ,
Apr 15, 2008 Apr 15, 2008

Copy link to clipboard

Copied

Place the cursor somewhere in the table to be resized and run the following script. It checks only if the cursor is in a table, nothing else -- it's very basic.

Peter

#target indesign

sel = app.selection[0];
if ( (sel.constructor.name != 'InsertionPoint')
&& sel.parent.constructor.name != 'Cell')
exit();

fw = framewidth (sel);
col = sel.parent.parent.columns;
col.everyItem().width = fw / col.length;

function framewidth (s)
{
var gb = s.parentTextFrames[0].geometricBounds
return gb[3]-gb[1]
}

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
New Here ,
Apr 16, 2008 Apr 16, 2008

Copy link to clipboard

Copied

Thanks. I use VBS, so here is what i got (with help of your code):

b Set MyInd = CreateObject("InDesign.Application.CS3")

b Set myTable = MyInd.Selection.Item(1).Parent.Parent 'recognize table

b gb = myTable.Parent.GeometricBounds 'width of page

b framewidth = gb(3) - gb(1)

b myTable.Width = framewidth

Now i'll think about proportional changing width of each column.

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
Community Expert ,
Apr 16, 2008 Apr 16, 2008

Copy link to clipboard

Copied

LATEST
Ah, yes, VB doesn't have everyItem(0. In that case you should set each column individually:

colwidth = fw / col.length
for (i = 0; i < col.length; i++)
col.width = colwidth;

Peter

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