How to change tables and cells styles all at once by using Java script? I want a dialogue box to enter stroke weight. Thank you

  • Hi there and welcome to the site. Please give us a little more information. Normally you would use Table Style and Cell Style to change all similar tables at once. Is there a reason why you can't do that? Many tables with no styling perhaps? And please tell us what you have tried to make your script work. How far have you come? Do you know scripting in InDesign? – Wolff Aug 28 '19 at 22:40
  • Hi Thanks for your reply. I have a 50 pages file with many tables and have different stroke weight. So I want a javascript to change all strokes (pop-up dialogue box to add required stroke weight) at once with a single click. – Moganti Ravi Sankar Aug 29 '19 at 6:51
  • I'm voting to close this question as off-topic because it is about programming. – Rafael Aug 29 '19 at 6:51

This little snippet should do what you want:

var sw = prompt("Enter stroke weight in points.", 1);

var c = app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem();

c.bottomEdgeStrokeWeight = c.leftEdgeStrokeWeight = c.rightEdgeStrokeWeight = c.topEdgeStrokeWeight = sw;
  • Thank you so much, it is working now – Moganti Ravi Sankar Aug 30 '19 at 13:04
  • In this case you could mark the answer as accepted, so others will know that the issue is solved. :) – mdomino Aug 30 '19 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.