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

Delete all the vertical lines in a file with multiple tables (Script)

Engaged ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

Please, need a help with this script as we have hundred of tables.

And make a total substitution.

Thanks

TOPICS
How to , Scripting

Views

339

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

Community Expert , Feb 05, 2024 Feb 05, 2024

That looks extremely easy to make with Table Styles. Have you used the Table Styles or Cell Styles panels at all? 

 

... if the answer is "no" then all of your cells have No Style and your tables have Basic Table style applied. If you make a Cell Style with your horizontal borders only, and then a Table Style that specified your new Cell Style in the "Body" dropdown.

 

tables.gif

 

... if you do have some Table Styles in use, you might have to "Apply Table Style, Clear Overrides." 

 

It's possible to do t

...

Votes

Translate

Translate
Engaged ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

Well, I mean deleting just the vertical ones to obtain something like this:

Screenshot 2024-02-05 at 4.26.28 PM.png

 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 ,
Feb 05, 2024 Feb 05, 2024

Copy link to clipboard

Copied

That looks extremely easy to make with Table Styles. Have you used the Table Styles or Cell Styles panels at all? 

 

... if the answer is "no" then all of your cells have No Style and your tables have Basic Table style applied. If you make a Cell Style with your horizontal borders only, and then a Table Style that specified your new Cell Style in the "Body" dropdown.

 

tables.gif

 

... if you do have some Table Styles in use, you might have to "Apply Table Style, Clear Overrides." 

 

It's possible to do this by directly applying Cell Styles, but it takes more clicks

 

It's possible to do this with scripting, by either automating the cell-border stuff, or by automating the application of table and cell styles with JS, but to be frank, I rarely encounter people using Table Styles at all, so when they say "Augh, how am I to do this to all of my hundreds of tables?" my typical response is "Well, all of your tables all share the Basic Table style, right? Because you haven't opened that panel since you were first learning ID, right?" and the answer has been 100% "You're right, Joel, I know where that panel is and I have never used it for anything." 

 

(One day I will encounter another user of Table Styles - I mean, one that's not already a regular poster here - but I'm not holding my breath.)

 

 

 

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
Engaged ,
Feb 06, 2024 Feb 06, 2024

Copy link to clipboard

Copied

No. This was not a correct answer.

And I am worried if someone has impersonated me on this forum because I did NOT mark the answer as correct.

1. Mr Chenney's answer is a solution but it is not correct for this case. I was looking for a script to chain it to others and do various formatting operations. What he proposes requires making adjustments to the menus that are not appropriate for what is required, which is to automate a process. Ergo,

2. There is a great free script by Eugenyus Budantsev that solves the request perfectly but it requires filling menus and therefore cannot be chained.

Ergo, a solution is not always a correct answer!

 

 

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
Engaged ,
Feb 06, 2024 Feb 06, 2024

Copy link to clipboard

Copied

Joel,

anyway your answer was very good.

A perfect method to avoid using the insoportable cell styles.

I don't agree the idea of making overriding manouvers. A solution for this, it necessary, is use character styles before any total clean.

Best regard.

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 ,
Feb 06, 2024 Feb 06, 2024

Copy link to clipboard

Copied

Well, it is completely true that my answer doesn't specifically respond to your request for a script: 

 

app.documents[0].stories.everyItem().tables.everyItem().cells.everyItem().properties = 
{
	topEdgeStrokeWeight : 1, 
	bottomEdgeStrokeWeight : 1,
	leftEdgeStrokeWeight : 0,
	rightEdgeStrokeWeight : 0
}

It's easy to add additional properties - including appliedCellStyle, if you want to go that way.

 

One of the things my Community Expert badge lets me do is mark answers correct, or remove correct marks, as appropriate. I imagine something similar has happened here; someone with some kind of moderator powers thought that this one was resolved, so they marked my response Correct. I've unmarked my previous answer, so you can come back and mark this answer as correct yourself. 

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
Engaged ,
Feb 06, 2024 Feb 06, 2024

Copy link to clipboard

Copied

LATEST

Joel,

no doubt you deserve to be called a gentleman. justice is unfair.

i would like to give you a double correct answer but the moderators will surely agree.

Thanks a lot for those great lines of code. We have to wait for the pension to be able to study scripting...

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