Merging Two Tables Together in InDesign

Sharon wrote: Is there any way to merge two tables into a single table? The bad news is that there is no way to merge two tables together in InDesign....

Sharon wrote: Is there any way to merge two tables into a single table?

The bad news is that there is no way to merge two tables together in InDesign. The good news is that you can do it outside of InDesign! The trick? Tagged text.

[Editor’s note written ex post facto: This is a great way to learn about tagged text, but there is now a much easier solution… read about it here.]

Tagged text is an often-overlooked feature in InDesign, but it lets you do all kinds of cool things to text. You can think of tagged text as being like HTML: It’s a way to describe text formatting using codes. The best way to see what tagged text looks like is to select some text in InDesign, choose File > Export, pick InDesign Tagged Text from the Save as Type (or Format) popup menu, and save it to disk. Now open that file in a text editor, such as NotePad, TextEditor, or TextWrangler.

Virtually anything you can put in a text frame you can express with tagged text. (I say “virtually” because I haven’t tested everything and I bet there are some things — such as anchored objects? — that just won’t handle the conversion to tagged text well.) Tables are part of a text flow, and they are converted into tagged text well. So if you put two tables in a row and export them as tagged text, you can tweak the codes to merge them into a single table.

Is this for the faint of heart? No! But it’s fun to know you can do it.

First, search for the text “TableStart:”. For example, it may appear like this: “TableStart:2,4:0:0”. That means this table has two rows and four columns. Change the number of rows to the total (this table plus the second table).

Now search for “TableEnd:”. That signifies the… well, I think you can get that one. To merge the table, delete all the text from the TableEnd tag (including the angle brackets around it) and ending just before the next “RowStart” tag. (But leave the angle bracket before “RowStart”, of course!)

Finally, save your new document (I suggest saving it with a new name so you can go back to the original if you make a mistake) and import this text file into your InDesign document using File > Place. The tables should be merged! If it doesn’t work, try again. If it still doesn’t work, take a look at the sample files I put here. If it still doesn’t work after you try 3 times and you can’t figure out what you’re doing wrong, you can email me. ;) I don’t guarantee this trick; it’s clearly playing with fire, but you can cook up some great results!

Bookmark
Please login to bookmark Close

This article was last modified on November 30, 2023

Comments (20)

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading comments...