Exporting Paragraph Styles of an InDesign File

Posted on 2007-08-06
Medium Priority
Last Modified: 2013-12-02
I need help exporting paragraph styles of an InDesign file to text file using javascript.

Also I need to export tags to a file as well.

function myExportStyle() {
      myDoc = app.activeDocument;
      // get current folder name
      var myFldrName = myDoc.filePath;

      // create file name to write by documentStyles.txt
      var myTextName = myDoc.name.split(".indd").join("Styles.txt");

      // set current file to path of document / documentnameStyles.txt
      var myFile = File(myFldrName + "/" + myTextName);
      // open file

      // write file
      myFile.write("Paragraph Styles " + myDoc.paragraphStyles.length + "\n");

      // close file
Question by:bergstrom_davin
  • 3
LVL 51

Accepted Solution

ahoffmann earned 1500 total points
ID: 19642125
are you talking about server-side javascript?

Author Comment

ID: 19642156
The file has a .jsx extension. I am not sure what you mean by server-side javascript.
LVL 75

Expert Comment

by:Michel Plungjan
ID: 19644132

Author Comment

ID: 19645877
I am attempting to write a script that will update the xml tree without losing attributes. I have received a good base code from Olav Knerv on the Adobe forums that I need to extent.

What I need to do is get a listing of all tag styles and paragraph styles and their association. So I can force mapping on paragraphs that have not been mapped automatically on a 100+ page document.

Author Comment

ID: 19647488
Here is the function I got working had to dig up the DOM for InDesign

function mySaveXmlMap () {
      var myMaps, myString, myDoc;

      myDoc = app.activeDocument;
      myMaps = myDoc.xmlExportMaps;
      myString = "";
      // creates tabbed list of stylename [tab] tagname [newline]
      for (count = 0; count < myMaps.count(); count++) {
            myString +=  myMaps[count].mappedStyle.name + "\t" + myMaps[count].markupTag.name + "\n";

      mySaveMappings (myString.trim());

function mySaveMappings (myString) {
      var myFilePath = myFindFile();
      var myFile = File(myFilePath);

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses
Course of the Month15 days, 8 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question