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

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

Unsubscribe at any time. Powered by Kit

153 replies on “Merge TextFrames Extension for Adobe InDesign”

  1. David says:

    Justin,

    Firstly, this is awesome for combining headlines, decks, and stories instead of grouping them.

    Secondly, It won’t merge columns. It deletes the multiple columns and makes it one column when it merges. Almost like it doesn’t register mulitiple columns…any suggestions?

  2. Justin says:

    Hi David, Thanks for you comment.

    There are different levels on which styling can be applied: character level, paragraph level, object level, etc. Multiple columns is not a property of the text itself, but a property the textframe that houses it. Since, in most cases, we’re moving the text into a different frame, object level styling, like columns, will be lost. There isn’t a great way to retain this, since each frame can potentially have different settings.

    The primary textframe will retain its object-level properties–minus the frame size if you choose to change that in the dialog box–so if you want multiple columns, make sure this frame has multiple columns. For example, if you’re sorting from the left and you want 3 columns, make sure your leftmost textframe has 3 columns. The end result will have 3 columns as well.

  3. Thatcher says:

    Thanks *so* much for creating this! I found out about it at http://www.InDesignSecrets.com, and it’s exactly what I’d been looking for about 2 months ago. Can I send a donation as a sign of gratitude/support?

  4. Justin says:

    Hi Thatcher, thanks for the feedback. Glad to hear it. I’ll try to add a donation system to the site within the week. Please check back in a few days.

    Donate button is now available at the bottom of sidebar on the right. >>>

  5. Fahim Moussi says:

    This is an awesome script! The only quarrel I’ve had so far is that you can’t merge two items, undo the merge, and then remerge them with new settings (or at all!). Is there some sort of cache I should be emptying?

    This is the message InDesign displays:

    Javascript Error!

    Error Number: 30614
    Error String: Invalid object for this request.
    Line: 503
    Source: arr[i].previousTextFrame = arr[i-1];

    It really is a great script though! Very useful when you’re creating tags for an XML export, and the designers (for style) use two separate text frames for one chunk of a content-type (i.e. one headline using two textboxes).

    Would you happen to have any tips for maintaining location geometry (position) when combining text frames? For instance, taking your example above, is it possible to maintain the staircase-like positioning of the three text frames? I can somehow imagine this being possible using the properties of tabs and the document’s geometry maybe..

    Thanks again for the wonderful tool!

  6. Justin says:

    Hi Fahim,
    Thanks for your comments.
    You can undo the script; it just takes more than one undo. To get back to the original state, I believe it takes twice as many undoes as the number of textframes that you merged. The reason it’s double the amount is to undo the addition of each separator. So, for three merged textframes, six undoes will get you back to the state before the script was run.

    I was able to replicate that error by trying to run the script after one undo. I’ll post an updated script at some point so that the error doesn’t appear, but that error only occurs because the undo is incomplete and the two selected textframes are already linked.

    In terms of maintaining the geometry, this is a fairly complex thing to do. It could be simulated somewhat by having the script add returns and tabs, but the positioning of these will vary with the text size, leading, paragraph spacing, indents, and tabs stops contained within each block of text. So this is very difficult to do with any kind of fidelity, and to try and write it to work in every possible scenario. This can be simulated somewhat using the custom separator. The separator field can actually be fairly complex. It could be several returns (\r\r\r\r\r) or a combination of returns and tabs(\r\r\t). In some scenarios, you may also want to run the script in blocks, with a tab(s) between two frames and then a return(s) between that merged frame and another frame or frames on the page. That way you have more control over the relative positioning.

  7. Chris Gosling says:

    Great script – but one request….

    Would it be possible to set default values for all the options. I often find myself doing repetitive “merging actions” and it would be great to set the options once.

    C

  8. Chris Gosling says:

    Let me amend my previous comment….

    Make it “easier” to set defaults – I found out where to change things in the coding – but now if I want the “original” version I have to change it back.

    It would also be cool to have a “dialog box free” version after you have set your defaults.

    But let me state again – FANTASTIC script – saves lots of time as is.

  9. Justin says:

    Chris,
    Here’s a script with all of the customizable variables at the top: MergeTextframes_ID_Custom.jsx.

    You can make a multiple copies of this file, give them different names, and change the variables at the top of the file. That way you’ll have quick access to every iteration of the script you want to run.

  10. Janeil says:

    Hi, I can’t download the plug in for CS3? When I click on the link I just get a page of code. Am I doing something wrong?

    1. Justin says:

      Janeil,
      The code you see is the javascript itself. Instead of clicking on the link normally, right-click (or ctrl-click on the Mac) on the link and choose Save Link As…

      You can also just use File > Save Page As… in your browser if you’re looking at the code itself. Once you’ve saved the file, you can pick up with the instructions from there.

  11. Great scrip! Thanks!!

  12. Ravisankar says:

    if i have one text frame i want to display first pargraph content and last paragraph content.

    if i have more than one text frame i want to dispaly the First text frame paragraph content and last text frame paragraph content.

  13. Justin says:

    Hi Ravisankar,

    Not sure what you’re looking for in your comment. Is this a request for a script? Please clarify.

  14. Prakash says:

    hai friends thanks to your scripts this is more help to me and like more scripts for ID3 pls tell me any other sorces

  15. colin flashman says:

    the MergeTextframes_ID_Custom.jsx. is just what i needed! i have 120 pages of family trees in individual text boxes which need to be merged so that the text can be repurposed. the original mergetextframes was good but agree with other posters that being able to customise it would be good, as there was still a level of repetition. now, set it once and turn the dialog off, and BOOM its just too easy!

    thank you so much for this script!

    1. Justin says:

      Glad to help, Colin! Thanks for the comment.

  16. Merge TextFrames script (.jsx, .mxp) http://tinyurl.com/amwmrh (Ajar Prod.) Could be useful when prepping InDesign files for #ePub #ePrdctn

  17. Mike Wood says:

    Is there a tool that will combine text frames on different pages?

  18. Justin says:

    Not sure, Mike. Looks like this script will link the text into one story:
    http://www.rorohiko.com/wordpress/indesign-downloads/textstitch/

    You could then detach/unlink the first frame and it should have all of the text in it.

  19. Arlene says:

    I installed the mxp file with extensions manager and when I run the text box merge script in Indesign CS4 I get the following error:

    ______________________________________________________________

    JavaScript Error!

    Error Number: 30614
    Error String: Invalid object for this request.

    File: /Applications/Adobe InDesign CS4/Scripts/Scripts Panel/Ajar Productions/MergeTextframes_ID.jsx
    Line: 534
    Source: arr[i].previousTextFrame = arr[i-1];

    ______________________________________________________________

    I am running 10.5.8 osx … used the same settings as in your screenshot above … any ideas?

    Arlene

  20. Justin says:

    Arlene, I’m not able to replicate this using any of my test files. If you want to post the file somewhere, I’d be happy to take a look at it.

  21. Media Grouch says:

    Confirm Arlene’s error report under exactly the same conditions, platform, etc etc but it beyond a calculable probability that it could be the same file [grin]. Files, actually.

  22. Justin says:

    Media Grouch, I had a chance to look at Arlene’s file. The error was originating from the fact that the textframes in question are linked. This script is designed to merge individual textframes. Attempting to run it on fully-designed layouts with linked textframes opens a different can of worms; it has the potential to really disrupt the layout. If you want to use the Merge Textframes extension in this way, I suggest you first run Samples > JavaScript > SplitStory.jsx from you Scripts panel to break your story into separate textframes. I also recommend saving a back-up of your file before attempting this.

  23. Media Grouch says:

    Media Grouch by name, grateful user by nature. I wish Adobe’s tech support was this good and this fast. Everything is now working as advertised, thank you. This has been a revelation: I did not know that there were pro InDesign users out there who did such sloppy work. I am doing this file rescue job pro bono for a not-for-profit, so time is… well, it’s just time actually, so it has to be pay forward. We have made you honorary members of our team. Abused and abandoned animals thank you for your kindness.

  24. Justin says:

    Happy to help, Media Grouch. My sympathies about the condition of the file. I’ve been in that scenario many times.

  25. Ken Smith says:

    Hi Justin! – This is brilliant as I’m running a data merge in indesign CS4 to import 1,700 entries into an events guide and wasn’t looking forward to hand linking all the text boxes.

    Using data merge all the copy is imported into the document in the correct paragraph styles – which saves a lot of time – but when I run your script all the Paragraph styles are lost, which still means a long night re-styling all the components of each entry…

    Is there a way of using your excellent script that retains the paragraph styles?

    Best Regards

    Ken

  26. Justin says:

    Ken, no matter how you run the script, it should retain the visual aspects of your paragraph and character styles. In order to actually retain the paragraph styles, though, you need paragraphs. Make sure there’s a hard return (\r) in the separator that you use, to keep each piece as separate paragraphs. That should do the trick.

  27. Justin says:

    Okay, Ken provided me with a test file (thanks, Ken!) and I think I got the issue worked out. My previous tests only included 1 paragraph style per textframe. New versions are posted (v 1.2.0). You’ll still need to use a hard return, but it should preserve all styles as expected now.

  28. John Towsen says:

    I’m getting this error message (CS4 on Mac OS 10.5.8)

    This file is not executable by any supported script language.

  29. John Towsen says:

    Okay, ignore previous message, as I was clicking on the .mxp file, instead of the .jsp file (hadn’t opened the Ajar folder)

    But I still have a problem. I want to select two text boxes at the same time to perform the script, BUT it seems I can only do this if they are on the same page. If the boxes are on two different pages, holding down shift to select the second one deselects the first. Am I missing something here? I’m using CS4 on Mac O.S. 10.5.8

  30. Justin says:

    John, That’s part of InDesign’s functionality. You can only select items on 1 page at a time. If you want to merge them, drag the textframes onto 1 page.

  31. Hey great script! I have a concern though….I am combining text frames that were created by doing a data merge. When I merge the frames it is reformatting my text to different font styles and also eliminating a character that I have copied and pasted as a square bullet. Any suggestions?
    Thanks!

  32. Justin says:

    Jaimee,
    Are you using the latest version (1.2.0)? That may resolve your issue. Let me know if it does not.

  33. Boy I hope so! I have about 8 data bases, 35 pages each to format if not…ugh. I originally downloaded the links that you have above….I’m sure I’m just not seeing it but is that 1.2.0 version on this page somewhere to download?

  34. Justin says:

    Looks like the JSX file was still linked to version 1.1.0. Sorry about that! The download links at the top should be up-to-date now.

  35. http://tinyurl.com/amwmrh
    Merge TextFrames Extension for Adobe InDesign | Ajar Productions

  36. Kovalenko says:

    Thanks, but “Apply to” no works (ID CS5 all pages).

  37. Justin says:

    Hi Kovalenko, apply to “all pages” works just fine on my CS5 test file. If you want to post your file to a file-sharing site and post (or send me) the link, I’d be happy to take a look at it.

  38. kc says:

    I tried the script on Text Frames that contained XML tagged text. The frames merged fine, but the XML tags are cleared from the resulting merged Text Frame. Is there any way to have the script merge frames that contain tagged text with out losing the tags?

  39. SOLO says:

    If I wanted a numbering sequence as my separator, can that be added into the script?..

  40. Justin says:

    @kc: I think that’s unlikely since some of the merged textframes properties are being lost in the processes, but I’ll try to look into this for future releases.

    @SOLO: Bullets and Numbering are applied at the paragraph level, so just use a hard return (\r) as your separator and apply manual numbering (Type > Bulleted & Numbered Lists > Apply Numbers), or preferably apply a paragraph style that has numbering. Every point of separation will then have a number.

  41. kc says:

    Justin – I figured preserving the XML tags would be a stretch. Thanks for considering it.

  42. Kyran o'Brien says:

    Love this but I cannot use it unless tags are included.
    I removed the Remove line from line 528 and the tags for whichever text box is last in the sort stay intact. (We already use another script to delete all empty frames so leaving it is not a problem)

    Any idea how I may be able to use this to keep all tags or why this would enable these tags to stay so I can try and edit further?

    Thanks again and look forward to hearing from you.

  43. Kyran o'Brien says:

    It appears to be clearing the tags at the function that replaces text.

  44. 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.

Comments are closed. Still have questions?

Contact Ajar