Skip to main content
dublove
Legend
August 15, 2021
Answered

How to implement the footer of the last behavior of a table with a script?

  • August 15, 2021
  • 7 replies
  • 2231 views

I need to set the last row of the table to be gross, and set the row height to 0.1mm.

At the same time, I want to set the bottom cell line to 0.3mm.

 

I hope some experts can help me realize it with scripts.

Sometimes the row height is too small to be selected manually.

Thank you.

This topic has been closed for replies.
Correct answer Willi Adelberger

Create a custom stroke in the stroke panel and choose that stroke.

7 replies

dublove
dubloveAuthor
Legend
December 19, 2021

How to add a new row at the end of the table and convert it to the "end of the table".
Then, apply the style "tab-foot" cell style to this row.

Community Expert
December 19, 2021

What do you mean by "end of the table"? If we add the row at the end, is it not already the end of the table, or do you want to do something special with it. Please explain this a bit clearly.

-Manan

-Manan
Community Expert
December 19, 2021

for example:
This table originally had 6 rows. Now I want to add a blank row as the table footer.


We went through this ad nauseam in the thread you started entitles "How to implement the footer of the last behavior of a table with a script?". If the solutions offered there don't work for you, please go back to that thread.

Community Expert
August 23, 2021

Hi dublove,

how are your scripting skills?

Did you ever write a script from a to z for InDesign?

 

You say: "I need to set the last row of the table…"

How would you like to identify the table in the document?

Is it the only one? Would you like to select the table?

 

If it is only one table make sure the table has one single footer row that you can use for the design you outlined in your screenshot. Or do you like to add quite another footer row for that purpose?

 

If my code did not work for you: Please provide a sample document with the table where the code did not work.

Put the document on Dropbox or a similar service and post the download link.

 

Thanks,
Uwe Laubender

( ACP )

Community Expert
August 18, 2021

If you have one single footer row it's:

table.rows[-1]

 

For properties of cells look up DOM documentation:

https://www.indesignjs.de/extendscriptAPI/indesign16/#Cell.html

 

Also:

https://www.indesignjs.de/extendscriptAPI/indesign16/#Table.html

 

Regards,
Uwe Laubender

( ACP )

dublove
dubloveAuthor
Legend
August 19, 2021

Sad, I don't know how to start……

Community Expert
August 17, 2021

An explanation:

I digged out one of my code snippets from 2015. See the related discussion:

 

Making a row smaller then 1,058mm?
blackbookeditora, Jun 30, 2015

https://community.adobe.com/t5/indesign/making-a-row-smaller-then-1-058mm/m-p/7275023

 

Also this related one from the same OP:

 

I need to force column widths to values smaller than the indesign preset minimuns (1,058mm).
blackbookeditora, May 13, 2014
https://community.adobe.com/t5/indesign/i-need-to-force-column-widths-to-values-smaller-than-the-indesign-preset-minimuns-1-058mm/m-p/6130821

 

Regards,
Uwe Laubender

( ACP )

dublove
dubloveAuthor
Legend
August 18, 2021

Can I automatically identify the last line.

Select all tables or place the cursor in the table.

Also, I need to set the thickness of the bottom border of the last row to 0.3mm

Community Expert
August 17, 2021

Hi dublove,

if I look at your screenshot there is a gap, that 0.1 mm, in the cells of your footer row.

 

 

Can I interpret this like I do in my screenshot below?

 

If yes it can be done by scripting.

When the footer row is the target ( or selected ) and the top stroke weight for all cells in the footer row is 0.1 mm:

 

//Select the table's footer row:
var myRow = app.selection[0];

// Optional:
myRow.cells.everyItem().contents = "";

// Not optional. 
// Set the point size in a value, so that the text could be visible despite the minimal height of the cells:
myRow.cells.everyItem().texts.everyItem().pointSize = 0.1;

myRow.cells.everyItem().topInset = 0;
myRow.cells.everyItem().bottomInset = 0;
myRow.cells.everyItem().height = "0.3 mm";

 

Regards,
Uwe Laubender

( ACP )

 

dublove
dubloveAuthor
Legend
August 22, 2021

How to implement it? There is no need to select rows

Just place the cursor in the table or select all tables,

You can operate on the last table row

Community Expert
August 16, 2021

Hi dublove,

suggestion to overcome a possible minimum row height issue:

Plan with a table 10 times the size you need it.

 

Scale the frame that holds the table to 10% with InDesign's preferences set to:

General > Object Editing > [x] Adjust Scaling Percentage

 

 

Effective height of the bottom stroke is 0.3 mm:

 

Table row selected in scaled text frame:

 

Regards,
Uwe Laubender

( ACP )

Community Expert
August 16, 2021

Clever! But planning a table 10 times its desired size is not so simple. Why not take an existing table, resize it 1000%, then add the last row, and resize 10%?

P.

dublove
dubloveAuthor
Legend
August 22, 2021

Hi~Peter Kahrel

How to implement it? There is no need to select rows

Just place the cursor in the table or select all tables,

You can operate on the last table row

dublove
dubloveAuthor
Legend
August 15, 2021

Like this

Community Expert
August 15, 2021

Rows must be at leat 3 pts (or 1.058 mm) high. So there's a problem..

P.