Reply To: Help with a Table Script

#97894
Mike Dean
Member

I think the easiest thing would be to leave the first line as is so it styles everything with the main body text style, then replace the second line with a GREP search that will find all number-only cells within that style and table.

So the second line would be replaced with something like this:
//create variables for paragraph styles
var tableBodyStyle = paragraphStyle(‘Table’, ‘Table – Body Text’);
var tableNumberStyle = paragraphStyle(‘Table’, ‘Table – Body Number’);

//GREP to find text that only contains numbers, comma separator, or decimal, currency symbol
app.findGrepPreferences.findWhat = “^[d,.$]+$”; //this can be reduced if you only need digits
app.findGrepPreferences.appliedParagraphStyle = tableBodyStyle;
app.changeGrepPreferences.appliedParagraphStyle = tableNumberStyle;

//search within current table
table.changeGrep();

This article was last modified on September 8, 2017

Comments (0)

Loading comments...