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

    • Joel: Thanks for fixing the links guys!
    • Maxwell Hoffmann: Ted, one aspect of the blog that may have escaped your notice; you can launch the HTML5 version in...
    • Maxwell Hoffmann: Joel, per comments made above, I discovered that the original URLs were incorrect with pointers to...
    • Maxwell Hoffmann: Paul, as I indicated in the comments below, the original blog had links that pointed to a...
    • Maxwell Hoffmann: I apologize to all concerned regarding my suggestion to “clear the cache” … it...