Improve the Way you Merge Cells in InDesign
April 18, 2012 | Snippets | en | fr
In a recent tutorial from ExpertsGraphiques (in French), Pierre Labbe has demonstrated a GREP-based method to merge two adjacent columns in a table while preserving the corresponding rows. It lies in fact that InDesign does not offer a so basic functionality! The “Merge cells” feature (which you access from the Table menu) is confined to globally merge all selected cells in a single one. Although P. Labbe showed great ingenuity, it seemed natural to investigate a more effective approach…
SmartCellMerge.js is an InDesign script (CS4, CS5+) that automatically acts on the currently selected cells. By default it performs a row-by-row merge and inserts tabs between the joined elements:
Of course you can select as many columns as required, or restrict the targeted rows to a more specific region.
The cool thing is that you can also adjust the SmartCellMerge's settings through a small dialog box. To access this feature, simply execute the script with no active selection. Here are the default preferences:
In the Direction panel, select “Vertically…” to make the script merge rows while preserving columns.
In the Separator field, enter the character(s) that you want to be inserted between merged elements. Use the additional icon buttons to insert special character codes: {TAB}
(tab character), {EOP}
(end of paragraph), and {FLB}
(forced line break).
Press Save settings to confirm your choices. Note that these settings are application-persistent, which means that SmartCellMerge remembers them even once InDesign has been turned off and restarted.
Comments
Bonjour Marc,
Super ce script.
Je pensais bien que c'était possible de scripter mais cela dépassait mes compétences.
J'ai testé le script, il fonctionne bien. Quand les cellules sont vides, la tab n'apparaît pas, c'est nickel !
Bravo.
A+
Pierre
Bonjour Marc,
Je me permets de vous solliciter pour un petit problème.
J'aimerai que la "hauteur des rangées" dans un tableau soit toutes à la même valeur et donc le systématiser un peu comme avec le script ProcessTable ou AutoFormatTables.
Merci de me dire si cela est faisable.