Sort text (paragraphs) in QuarkXPress 2018

You have text in a text box in QuarkXPress that needs to be sorted?

A list that needs to be in alphabetical order?

In QuarkXPress 2018 it is easy to sort text (paragraphs), using a sample JavaScript:

Sort text in QuarkXPress using a simple JavaScript

  1. Open the JavaScript palette in QuarkXPress 2018 and navigate to “Samples > Typography”
  2. Select the text box that you need sorted
  3. Run the JavaScript “Sort Paragraphs.js”
  4. Enter whether you want the data to be sorted Ascending or Descending
  5. Enter whether you sort text or numbers


Of course this is undoable.

Remember that this is a script that you can edit and change yourself, should you want to make changes. E.g. you could make a script that doesn’t prompt you about ascending/descending or text/numbers and just runs.


  • As QXML (the text formatting accessible by JavaScript) does not support every construct in text, you will loose features which are not yet supported by QXML such as Callouts, Footnotes, Endnotes, Cross References, Anchors etc. from the selected box.
  • The Script sorts the entire content of the selected text box, not just a selection.

Quick video showing this example

More sample JavaScripts for QuarkXPress on github

Quark has created a page on github to share more sample scripts and to encourage users to share their scripts:

Both an engineer and a layout artist, Matthias bridges the gap between technology and people.

Before joining Quark, Matthias pioneered print, Web, and multimedia products for multiple German publishing companies. Since 1997 he has played a central role in shaping Quark’s desktop and enterprise software.
Starting 2003 Matthias has focused on Quark’s interactive and digital publishing solutions. He is an active participant in design and publishing communities and represents Quark in the Ghent PDF Workgroup.

Since February 2014 Matthias heads Quark’s Desktop Publishing business unit and is therefore responsible for QuarkXPress.