ExtendScript of the week : “Applying a particular table style to all the tables in a document”

Wednesday, September 28 2011 @ 2:47 PM, By Vikash Kumar

Continuing with the “ExtendScript of the Week” series , this week we are providing a script to  apply a particular table style to all the tables in a document. Before applying the format it removes all the cell formatting overrides if present in any of the tables. This Script demonstrates the power and ease with which tables can be manipulated in FrameMaker via ExtendScript.

About the Script:

1) On execution ,this script prompts the user to enter any existing table style in a document.

2) It then iterates over all the tables and removes any cell formatting overrides if present in any of the table.This is done only for those tables present on Body page

3) It then applies the table style entered by the user to all the tables in the document. Again this is done only for those tables present on Body Page.

4) Finally it alerts the user about the number of tables on which the format got applied.

Running the Script against a sample document:

1) Open the attached document “test2.fm” in FM  and make sure that it has focus.

2) Note that there are 3 tables in the document. Tag  “Format A” has been applied on the first and third while
“Format B”  has been applied on the second one

3) For running the script , click File->Script->Run and then browse for the script. When prompted for table tag, enter <tagc>.

4) After running the script , note that in the test document, “tagc” has been applied on all the tables.
The difference can be seen in the outer border ruling of all the tables which will now be thick.

For Sample file and Script, Click on the link below and then Unzip the downloaded file to get the test file and script.



  • Categories

  • Archives

  • Authors

  • Useful Links

  • Recent Comments

    • Dieter Gust: Congratulations for a great work done! We finally got several exciting new features. My favorites: 1.)...
    • Maxwell Hoffmann: Hello Paul; I just tried link to video with Chrome and it does work. Try this; clear cache in your...
    • Paul: I could not get this presentation to play. I tried it in both IE and Chrome. It would start to play and get...
    • Jeff Coatsworth: Hey Vikram – the link to the helpx article is still resolving as “https://helpx.stage....
    • Thomas Böttiger: Thank you for fixing the template bug. Unfortunately I had to convert my projects to a competing...