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

How to make sure all my tables are the same width?

Enthusiast ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

Is there an easy way to make sure the overall width of my tables are the same? I know how to do each cell, but that would be tedius to go check that for 42 pages of tables I've created. I was given this document, and the table widths on each page vary. I'd like them to be standard. But I am not seeing how to find the overall width of a table without adding up each width of each cell. 

Thanks!

 

Julie

 

 

TOPICS
How to

Views

460

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

Community Expert , Mar 08, 2023 Mar 08, 2023

If the column widths are intended to be the same in all of the tables, you could use the script from this page to save the column widths from one table, and apply them to other tables that share the same Table Style. 

It's not entirely automatic; you have to select each table and then apply the widths, but it is faster than manually checking and adjusting every cell in every table.

Votes

Translate

Translate
Community Expert ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

If the column widths are intended to be the same in all of the tables, you could use the script from this page to save the column widths from one table, and apply them to other tables that share the same Table Style. 

It's not entirely automatic; you have to select each table and then apply the widths, but it is faster than manually checking and adjusting every cell in every table.

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 ,
Mar 16, 2023 Mar 16, 2023

Copy link to clipboard

Copied

Thank you! I'll give it a try.

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 ,
Mar 16, 2023 Mar 16, 2023

Copy link to clipboard

Copied

LATEST

I finally had time to figure this out. And it worked perfectly. Thank you! 

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 ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

Hi Julie, Try this script, which asks you for a cell width and sets all of the table cells:

 

 

var x;
makeDialog();
function makeDialog(){
    var d = app.dialogs.add({name:"Adjust Table Cells", canCancel:true});
    with(d.dialogColumns.add()){
        staticTexts.add({staticLabel:"Table Cell Widths:", staticAlignment:StaticAlignmentOptions.LEFT_ALIGN, minWidth: 150});
        x = measurementEditboxes.add({editUnits:MeasurementUnits.INCHES, editValue:72, minWidth:90});
    }
    if(d.show() == true){
        x = x.editValue;
        adjustTable()
        d.destroy();
	}
}


function adjustTable(){
    app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;
    var t = app.documents[0].stories.everyItem().tables.everyItem().cells.everyItem().getElements()
    if (t.length > 0) {
        for (var i = 0; i < t.length; i++){
            t[i].width = x
        }; 
    } else {
        alert("Document has no tables")
    } 
    app.scriptPreferences.measurementUnit = AutoEnum.AUTO_VALUE;
}

  

 

 

 

Screen Shot 15.png

 

 

After run:

Screen Shot 16.png

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 ,
Mar 16, 2023 Mar 16, 2023

Copy link to clipboard

Copied

Thanks! I'll try it! 

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