Skip to main content
karthikS
Inspiring
March 21, 2016
Answered

How to remove table border

  • March 21, 2016
  • 2 replies
  • 5351 views

Dear kings,

I was try to remove border from tables (my coding below).

This coding not working "Result: undefined"? how to remove all table borders. please suggest friends.

var mTables = app.activeDocument.stories.everyItem().tables.everyItem(); 

with (mTables) { 

  topBorderStrokeWeight = 0;

  bottomBorderStrokeWeight = 0;

  leftBorderStrokeWeight = 0;

  rightBorderStrokeWeight = 0;

  }

alert("Done")

Advance thanks all

This topic has been closed for replies.
Correct answer tpk1982

try this,

if(app.activeDocument.stories.everyItem().tables.length>0)

{

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().bottomEdgeStrokeWeight = 0;

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().topEdgeStrokeWeight = 0;

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().leftEdgeStrokeWeight = 0;

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().rightEdgeStrokeWeight = 0;

}

2 replies

tpk1982
tpk1982Correct answer
Legend
March 22, 2016

try this,

if(app.activeDocument.stories.everyItem().tables.length>0)

{

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().bottomEdgeStrokeWeight = 0;

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().topEdgeStrokeWeight = 0;

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().leftEdgeStrokeWeight = 0;

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().rightEdgeStrokeWeight = 0;

}

karthikS
karthikSAuthor
Inspiring
March 22, 2016

Dear tpk1982 and Ronald63,

very very very very Thanks you so match my friends both.

Both are coding working super, nice and good.

I am so happy friends,

One more thanks dears,

Participating Frequently
December 11, 2018

bernardf54817818  wrote

… No clue what a code is

Why are you saying this?!? You are posting in the InDesign Scripting Forum.

Nevertheless, the following code is removing all strokes from the table of your sample document. Just tested that.

app.activeDocument.stories.everyItem().tables.everyItem().cells.everyItem().properties =

{

    bottomEdgeStrokeWeight : 0 ,

    topEdgeStrokeWeight : 0 ,

    leftEdgeStrokeWeight : 0 ,

    rightEdgeStrokeWeight : 0

};

Before:

After running the ExtendScript code:

Regards,
Uwe


Uwe:

I posted here because there were several other posts about not being able to remove the TABLE borders. I see you had removed the CELL borders. If you look on the TABLE settings, you will see I had to select "Paper" as the TABLE border (the border that goes around the outside of the table) so that it blends with the paper. If I select NONE or set the the width to 0, it defaults to black.

Thanx.

Legend
March 21, 2016

Hi,

Try this ...

var mTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();

var mLen= mTables.length;

while (mLen --) { 

    mTables[mLen].topBorderStrokeWeight = 0;

    mTables[mLen].bottomBorderStrokeWeight = 0;

    mTables[mLen].leftBorderStrokeWeight = 0;

    mTables[mLen].rightBorderStrokeWeight = 0;

  }

alert("Done")

karthikS
karthikSAuthor
Inspiring
March 21, 2016

Hi Ronald63

Thanks your response,

I have run the your script. Sorry for saying this Ronald63, that coding not working "Result: undefined"? (attached screenshot for your reference). This same problem happening my said also. Please give me other solution and suggest Ronald63.

Legend
March 21, 2016

It's working for me, can you share your indesign document ?