• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Reformatting table strokes

Explorer ,
Jun 09, 2020 Jun 09, 2020

Copy link to clipboard

Copied

Hello! I'm trying to find an easier way/script to change table stroke styles from dotted to solid in batch throughout multiple master pages. I made a mistake previously and now I'm having to change all of the dotted lines to solid... Please help!!

TOPICS
Scripting

Views

866

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Jun 09, 2020 Jun 09, 2020

"Solid" doesn't work for me! … [french]

Playing with the "cells"! …  ðŸ˜‰

 

 

// by FRIdNGE, Michel Allio [09/06/20]
var myCells = app.activeDocument.masterSpreads.everyItem().textFrames.everyItem().tables.everyItem().cells.everyItem();      
myCells.topEdgeStrokeType = myCells.rightEdgeStrokeType = myCells.bottomEdgeStrokeType = myCells.leftEdgeStrokeType = app.activeDocument.strokeStyles[17];

 

(^/)  The Jedi 

Votes

Translate

Translate
Community Expert ,
Jun 09, 2020 Jun 09, 2020

Copy link to clipboard

Copied

Hi Channers:

 

If you used a table style (and perhaps cell styles), you can redefine the style(s) and InDesign will locate all of the tables for you and update the strokes—that is the quickest approach and demonstrates why designing with styles is so important.

 

Did you use styles? If not, where are the strokes and how did you define them?

 

~Barb

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 09, 2020 Jun 09, 2020

Copy link to clipboard

Copied

Hi Barb, thank you for your reply! I didn't use styles... the strokes were directly applied to the tables. Like I said, I made a mistake as this document is something I had made when I first learnt InDesign a few months back. I guess I'm going to have to do it manually. Thanks!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 09, 2020 Jun 09, 2020

Copy link to clipboard

Copied

Hi there,

 

Give us something to work upon, a base code that you wrote and that might not be working as per your wants. Tweaks in an existing solution, idea sharing can be done frequemtly but straightaway asking for a readymade solution is a bit being too optimistic. Lets see if someone has something similiar written that can be shared.

 

-Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 09, 2020 Jun 09, 2020

Copy link to clipboard

Copied

Hi Manan, thanks for your reply! Unfortunately, I'm fairly new to InDesign and I have no idea how scripts work. I've recently enrolled into a Javascript course to help me with this but it's not something that can be learnt overnight. I am looking forward to being able to write codes myself though. Thanks for your help!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 09, 2020 Jun 09, 2020

Copy link to clipboard

Copied

Try if the following works for you, it will convert all the stroke of all the tables present on every master page in the current document to solid style

 

var st = app.documents[0].masterSpreads.everyItem().textFrames.everyItem().parentStory
for(var i = 0; i < st.length; i++)
{
	var tb = st[i].tables
	for(var j = 0; j < tb.length; j++)
	{
		tb[j].topBorderStrokeType = "Solid"
		tb[j].rightBorderStrokeType = "Solid"
		tb[j].leftBorderStrokeType = "Solid"
		tb[j].bottomBorderStrokeType = "Solid"
	}
}

 

 

-Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 09, 2020 Jun 09, 2020

Copy link to clipboard

Copied

"Solid" doesn't work for me! … [french]

Playing with the "cells"! …  ðŸ˜‰

 

 

// by FRIdNGE, Michel Allio [09/06/20]
var myCells = app.activeDocument.masterSpreads.everyItem().textFrames.everyItem().tables.everyItem().cells.everyItem();      
myCells.topEdgeStrokeType = myCells.rightEdgeStrokeType = myCells.bottomEdgeStrokeType = myCells.leftEdgeStrokeType = app.activeDocument.strokeStyles[17];

 

(^/)  The Jedi 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 09, 2020 Jun 09, 2020

Copy link to clipboard

Copied

This worked beautifully. Thank you so much Michel!!! Really appreciate it 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 09, 2020 Jun 09, 2020

Copy link to clipboard

Copied

Thank you for your help Manan!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 10, 2020 Jun 10, 2020

Copy link to clipboard

Copied

Hi Michel,

in case the index number of the stroke style will change in future versions of InDesign you could address the style also by name:

 

myCells.leftEdgeStrokeType = 
app.activeDocument.strokeStyles.itemByName("$ID/Solid");

 

Best,
Uwe Laubender

( ACP )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 10, 2020 Jun 10, 2020

Copy link to clipboard

Copied

Hi Uwe,

 

Personally, I prefer to use an UI and a Stroke Styles pop-up/list like in this script I've written 2 years ago:

 

Capture d’écran 2020-06-10 à 16.53.22.png

I use a "French" InDesign! … So the list would be of course in "German" for you!  ðŸ˜‰

 

Best!

(^/)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 10, 2020 Jun 10, 2020

Copy link to clipboard

Copied

LATEST

Hi Michel,

of course it will return the right localized string, why not?

My German InDesign will return the German "Durchgezogen" which stands for "Solid" with that code:

 

app.activeDocument.strokeStyles.itemByName("$ID/Solid").name
// Result: "Durchgezogen" with my German InDesign

 

Regards,
Uwe Laubender

( ACP )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines