Merge TextFrames Extension for Adobe InDesign

By request—following similar extensions for Flash and Illustrator—here’s an extension for InDesign that merges multiple textframes into one, while retaining the original styles.

Because of properties within InDesign, this extension is actually the most powerful of the three. It accepts characters in the separator field for hard returns, soft returns, and tabs (as well as any combination of any other standard characters).

There are also options in the dialog box that control the size of the textframe once it’s been merged (see the variations in the graphic down the page).

Merge Textframes Extension for Adobe InDesign

Download and instructions below…

Download

Merge Textframes is totally free to use by subscribing to our newsletter.

Enter your information below to get the free download.

You can unsubscribe at any time. I will never spam you or sell your information.

Installation

The download package comes with installers for InDesign CC, as well as CS4 – CS6.

Simply double-click on the installer that matches your setup and follow the onscreen instructions.

There’s also an older version of the script for CS – CS3.

More details provided in the README.txt file.

Usage

Start by select the textframes you want to merge in InDesign (unless you want to merge entire pages).

Running from the Object or Context (right-click) menus

As of v2, you can now get easy access to Merge Textframes from the Object menu, or by right-clicking and choosing Merge Textframes…
InDesign Object menu option

And you can still run it from the Scripts panel.

Running from the Scripts panel

Open the Scripts panel, Windows > Utilities (or Automation pre-CS5) > Scripts.

InDesign Scripts Panel

Locate the MergeTextframes_ID.jsxbin script in the Scripts panel and double-click to run the script. If you installed the script using the CC installer or the MXP file, the script with be in the Ajar Productions subfolder.

Choose options from the dialog

If you’re running InDesign CS4 or newer you will be prompted with a dialog box. The dialog box will allow you to select the orientation of the sorting (top, left, bottom, right), use a custom separator character(s), and select options to fit the merged textframe once complete.

Frame fitting options

Update (6/13/2017)

Version 2.0 adds the following highly-requested features

  • Single-step undo
  • Saves and restores previous settings
  • Lets you merge text frames that are part of a linked story

Plus a CC-friendly installer. 🙂

Update (3/02/2010)

Version 1.1.0 now has the ability to batch-merge textframes within every page of the current document. I had several requests for something like this (including from a recent donor). Here it is! The download links above have been updated.

The new version now has the “Apply to” and “Ignore locked layers” as shown in the image below.

Merge Textframes version 1.1.0 new features

Note that any warning messages about having too few textframes selected have been delayed until after the dialog box appears to reflect the new options.

Thanks for visiting this page and using our extension!

Before you go, grab another free InDesign extension

Need to do the opposite? Grab Split Text to break InDesign text frames apart.

Get updates from Ajar Productions

Splittext id 400px

Sign up today and get the InDesign Split Text premium extension for free!

Unsubscribe at any time. Powered by ConvertKit
Justin | ExtendScript,extensions,InDesign | Friday, November 28th, 2008

137 thoughts on “Merge TextFrames Extension for Adobe InDesign”

  1. Justin says:

    Hi Kyran,
    I’m not very familiar with tags, but if you want to post a sample file, I’d be happy to take a look at it.

    The script will retain styles, so you should be able to re-associate tags by style, if that’s relevant.

  2. Kyran says:

    Sure I will e-mail you the InDesign doc and the XML file we load into InDesign that creates the tags.

    Here is a little backgroud.
    Alot of retail advertising firms are going to XML import of information into InDesign. That way the merchant staff is providing the copy to the advertising staff for products being sold and the prices come straight from the mainframe. Whenever the XML is updated the most recent copy and prices come into the InDesign doc. We use a demandTec product PPM for this process.
    This being said I do not want to reassociate tags as it could mess up price and copy updates.
    Any help would be greatly appriciated.
    Thanks again.

  3. Justin says:

    Thanks for the background, Kyran. I look forward to testing the file.

  4. HJ says:

    Awesome script, thanks so much! Really helped tidy up the layout when doing a data merge for a show guide (could put imported text into a text frame with columns, rather than each bit of import being in a seperate frame) 🙂

  5. David says:

    I’m getting the following error whenever I try to use a separator. Any thoughts?
    ______________________________________

    JavaScript Error!
    Error Number: 45
    Error String: Object is invalid
    Line: 535
    Source: arr[i-1].textStyleRanges.lastItem().contents += separator;

  6. David says:

    @David
    I ended up adding the separators in my original single-record InDesign file, performed the multi-record data merge to a new InDesign file, then used the script to merge the text boxes without attempting to add any separators.

  7. Justin says:

    Hi David,
    That’s interesting. What are you using as a separator?

  8. David says:

    @Justin
    I attempted to use \r, \n, and \t. None of them worked for me.

    Thankfully, I was able to work around it by just adding the separators to the template before performing the data merge and text box merge.

  9. Justin says:

    @David interesting. No one else has reported this bug. Please let me know if you have any other details (file specifics, ID version, OS, etc). If you can test it on another file that would be great, too. You’re welcome to follow up via email if you prefer. Thanks!

  10. nanogod says:

    Great Script! Saved me some sleepless nights!
    Thank you so much!

    Greetz nanogod

  11. Justin says:

    Awesome! Glad to hear it, nanogod!

  12. Bob says:

    Thank you x 10^23 for this script, and all of the work that you put into it’s development. It just saved me 2 days of work, and I didn’t even have to quit InDesign to install it 😉

    AWESOME!

    ps I going to make my boss donate for sure.

  13. Justin says:

    Hi Bob,

    Thanks so much for your comment. I’m glad I was able to save you 2 days of work! That’s music to my ears. The donation will be much appreciated as well!

  14. chiemeka says:

    I tried this but found that it flips the output text upside down.

  15. Justin says:

    Hi Chiemka,
    This script merges all of the text into the first frame in the sequence. Is it likely that there’s some kind of transform applied to that text frame.

  16. chiemeka says:

    You’re quite right. It is working okay now that I have excluded the first frame.
    🙂

  17. 248 says:

    Works like charm mate!

    Thank you…

  18. Justin says:

    Glad to hear it, 248!

  19. Matt says:

    Thank you! This works perfectly in CS6 and has saved hand-merging over 800 text boxes.

  20. Justin says:

    Excellent. Glad to hear it, Matt!

  21. Stacy Wright says:

    I was thinking, after I learned how to Data Merge my 400 listings into InDesign, that it would nice if I could NOT have 400 text frames.
    After successfully installing your script, (btw this is the first time I have ever installed a script) I exalted in joy for at least five min.

    God bless you, Thank you.

  22. Justin says:

    Awesome. Great to hear it, Stacy!

Leave a Reply

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