Monday, January 08, 2007

 

Story Editor for Tables?

One of the frustrations of working with large tables is that if you have an overset cell, it is hard to find out what's in it from the UI. Would that you could summon the story editor to look at the contents of a cell! But you can't. So, it occurred to me to write a script to label all the cells of a table with their contents. This might be overkill -- perhaps a script to label only the selected cell would be sufficient, but by labeling them all I get the chance to have the Script Label palette open and immediately see the contents of an overset cell without having to do anything more than look. I suppose, later, I should run a script to clear out the labels just because of the amount of extra text my document will be carrying around.

Here's the script:
//DESCRIPTION: Label Every Cell of Table

if (app.documents.length == 0 || app.selection.length == 0) { exit() }
processSelection(app.selection[0]);

function processSelection(sel) {
  var myTable = findTable(sel);
  var myCellLabels = myTable.cells.everyItem().texts[0].contents;
  for (var j = myTable.cells.length - 1; j >= 0; j--) {
    myTable.cells[j].label = myCellLabels[j];
  }
  
  function findTable(obj) {
    while (obj.constructor.name != "Table") {
      obj = obj.parent;
      if (obj.constructor.name == "Application") {
        throw "Can't find table"
      }
    }
    return obj
  }
}
Ah, it's not true that I have to do nothing to see the label. I have to hit Command-/ to select the cell.

Dave

Comments:
I really need a CS3 InD script to select all tables (raw imported from a placed Word doc) then apply "Table Style 1" and clear all overrides (both table style and cell style)...please plase please.

I'm applying one by one to over 200 tables and I'm grateful to have the Table styles in CS3, but some idiot decided to use a million tables in this Word doc to create a description list. :-(

Thank you so much!
 
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?