InDesign: Accessing document dictionary


In my script, I am copying a table of cells that have a lot of text in them. This text has a bunch of custom hyphenation rules that are saved in the document dictionary, NOT in the user dictionary. This is accessed in the UI by opening <em>User dictionary</em> and selecting the document under <em>Target</em>.

When copying the table to another document, these rules are unfortunately not copied with it, and the text is changed.

How can I access this custom document dictionary so that my hyphenations are retained in the target document?

It is possible to access the user dictionary with UserDictionary, but where is the document dictionary located?


Answering this myself since I finally found the proper class to use:

The document dictionary can be accessed using HyphenationExceptions. To get all custom hyphenations from my target document, I did the following:

var myHyphenations = app.activeDocument.hyphenationExceptions; for (var i = 0; i < myHyphenations.length; i++) { if (myHyphenations[i].name === "Danish") { var mySourceDictionary = myHyphenations[i]; mySourceHyphenations = mySourceDictionary.addedExceptions; break } }

For some reason, it seems that it is NOT possible to get a certain HyphenationException using its name.

In other words, the below code does not work (it actually gives me a Norwegian dictionary):

var mySourceDictionary = app.activeDocument.hyphenationExceptions.item("Danish");

For this reason, I had to loop the array until I found the one I needed: ("Danish").


  • Android Personal Dictionary App Issues
  • Internet explorer and removeChild()
  • how to release bitmap memory in android
  • RewriteCond and RewriteRule in .htaccess
  • Visual Studio extension: Change the hint path of an assembly reference
  • Publishing commands to device in IBM IoT using MQTT in Java
  • JUnit testing package private class in Maven formatted project
  • boost::format vs sprintf
  • Access 2007 forms with parameterized RecordSource
  • Opening links in a new tab and only the new tab
  • Listen to the 'change' even of an element in the shadow DOM
  • Notepad++ - delete all lines with certain text
  • XBee Linux Serial Port on Rasberry Pi
  • Fat binaries in iOS
  • What does Main.1 output file do in XCode?
  • Why is django manage.py syncdb failing to create new columns on my development server?
  • Opening two instances of InAppBrowser (_system and _blank) prevents events from triggering
  • It is possible use the same sql azure instance from two different cloud service of two different sub
  • change color of jstree node
  • ImportError: cannot import name Pubnub
  • Passing variable arguments using PowerShell's Start-Process cmdlet
  • How to retrieve information from antrun back to maven?
  • netsh acl setting (need alternative method - registry settings?)
  • SAVE attribute needed for Fortran variables when only the C_LOC address is returned to a C program?
  • Sonar maven jacoco code coverage for Multimodule project
  • ViewController With Transparent Background Entering Current ViewController With Push Transition
  • Change JButton Shape while respecting Look And Feel
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • Running a C# exe file
  • Shallow update not allowed (git > 1.9)
  • jquery mobile loadPage not working
  • jQuery tmpl and DataLink beta
  • How to include full .NET prerequisite for Wix Burn installer
  • Free memory of cv::Mat loaded using FileStorage API
  • Qt: Run a script BEFORE make
  • Authorize attributes not working in MVC 4
  • Busy indicator not showing up in wpf window [duplicate]
  • Unable to use reactive element in my shiny app
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF