Skip to main content
revathiv80720177
Known Participant
June 6, 2017
해결됨

Merging of table cells using scripts in InDesign

  • June 6, 2017
  • 4 답변들
  • 5256 조회

Hi,

I have to merge cells of table using script. I have a table as shown below,


       

ROD DIAMETER

ROD DIAMETER TOLERANCE 1

ROD DIAMETER TOLERANCE 2

HOUSING DIAMETER

HOUSING DIAMETER TOLERANCE 1

HOUSING DIAMETER TOLERANCE 2

1.750

+.000

-.003

2.174

+.004

+.000

2.500

+.000

-.004

3.116

+.005

+.000

5.000

+.000

-.004

5.616

+.005

+.000


Now, I have to merge cells as shown below,

    

ROD DIAMETER

HOUSING DIAMETER

HOUSING DIAMETER TOLERANCE 1

HOUSING DIAMETER TOLERANCE 2

1.75     '+.000

           '-.003

2.174

+.004

+.000

2.500   '+.000

           '-.004

3.116

+.005

+.000

5.000   '+.000

            '-.004

5.616

+.005

+.000


How can I merge cells using scripts. Please do guide me!

Regards,

Revathi

이 주제는 답변이 닫혔습니다.
최고의 답변: Colin Flashman

There is a script from Indiscripts that is exactly for this purpose:

Indiscripts :: Improve the Way you Merge Cells in InDesign

The script works most of the time but I have noticed from time to time that despite selecting the cells and running the script, nothing happens, but if I select fewer cells, then the script works again. Bizarre.

4 답변

Andrei_B
New Participant
April 5, 2018

Thanks Colin

Colin Flashman
Community Expert
April 5, 2018

Marc's script does that to me from time to time. I find if I make a smaller selection, that will work, so it may mean running the script a couple of times.

Dirk becker also has a script that works as a startup script but serves a similar purpose: Scripts for InDesign Tables

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!
Colin Flashman
Community Expert
June 7, 2017

There is a script from Indiscripts that is exactly for this purpose:

Indiscripts :: Improve the Way you Merge Cells in InDesign

The script works most of the time but I have noticed from time to time that despite selecting the cells and running the script, nothing happens, but if I select fewer cells, then the script works again. Bizarre.

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!
revathiv80720177
Known Participant
June 7, 2017

Hi  Colin,

Thanks for your response.I have my cells as ,

1.750+.000-.003
2.500+.000-.004
5.000+.000-.004

Using the script I was able to merge my cells as ,
   

1.750

+.000 -.003

2.500

+.000 -.004

5.000

+.000 -.004

I tried to merge it as,

  

1.750

+.000

-.003

2.500

+.000

-.004

5.000

+.000

-.004

I tried to change the row values to columns but the merging of cells remain the same. Please do guide me.

Regards,

Revathi

Community Expert
June 7, 2017

Hi Revathi,

if "the script" is the one written by Marc Autret—SmartCellMerge.js—you can change the separator to the one you like to see. I guess it'll be "End of Paragraph" {EOP} .

Or use any other sequence of characters.

Marc defined three that you can insert with buttons:
"Tabulator", "End of Paragraph" and "End of Line".

To get to that dialog where you can define this, run the script without selecting anything.

Marc Autret is describing this in detail.

Indiscripts :: Improve the Way you Merge Cells in InDesign

http://www.indiscripts.com/blog/public/data/improve-the-way-you-merge-cells-in-indesign/_en_04.png

Regards,
Uwe

Liphou
Inspiring
June 6, 2017

Bonjour,

Ceci peux vous guidez,

Ex :

var ligne04 = "Test: ";

if(app.documents.length != 0){

        if(app.selection.length != 0 && app.selection[0].constructor.name == 'Table'){

               

                var nomTableau = app.selection[0];

               

                        nomTableau.rows[0].cells.item(0).merge(nomTableau.rows[0].cells.item(1));

                        nomTableau.rows[0].cells[0].texts[0].insertionPoints[0].contents = ligne04;   

                               

                exit();           

            }

        else{

                    alert("Selection un tableau");

                    exit();

                }

        }

    else{

        alert("Ouvrait un document et Mettre son cuseur dans le points de départ");

        exit();

}