Copy link to clipboard
Copied
Hello, please.
What should I write in the next sentence?
merge the rows where the cursor is and fill in Cell with the word "Continue"
No need to select the the row.
thank you~
Copy link to clipboard
Copied
Here you go - if you need something more specific just let us know
// Ensure a document is open and a text insertion point is selected
if (app.documents.length > 0 && app.selection.length > 0 && app.selection[0].constructor.name === "InsertionPoint") {
var cursor = app.selection[0];
var parentCell = cursor.parent;
// Check if the cursor is within a table cell
if (parentCell.constructor.name === "Cell") {
try {
var parentRow = parentCell.parentRow;
// Merge all cells in the parent row using the first and last cells of the row
var firstCell = parentRow.cells[0];
var lastCell = parentRow.cells[parentRow.cells.length - 1];
firstCell.merge(lastCell);
// Set the content of the merged cell to "Continue"
firstCell.contents = "Continue";
alert("Row merged and cell updated with 'Continue'.");
} catch (e) {
alert("An error occurred: " + e.message);
}
} else {
alert("Please place the cursor inside a table cell.");
}
} else {
alert("Please open a document and place the cursor inside a table cell.");
}
Copy link to clipboard
Copied
It works. It's great.
Thank you very much.
Here's what I initially thought:
1. select the header row of the table (could be 1 or 2 rows)
2. add 1 new row before the selected row.
3. merge the newly created rows and put in the “continue” character
4. for the new line to apply the “cont” cell style
5. set the new line of the exact row height of 5mm.
6. will be “initially selected rows and new rows” converted to table header rows.
7. Set to skip the first page of the table header row.
I originally asked a poster.
https://community.adobe.com/t5/indesign-discussions/is-there-a-script-to-automatically-continue-rows...
Am I being greedy?
I feel a little guilty
Copy link to clipboard
Copied
If you just want to have a Continue row you don't need to do anything like that - if it's just for new frames and you want to show it's continuing
The only thing to be aware of is the first frame you have to insert the header rows as text - so if you want to manipulate the headers of row 2/3 you need to copy the text from 2nd frame back to the original frame.
As I highlight here - this text needs to be changed manually.
But you get your continuation rows.
No idea why you opened a new thread for the same thing - confuses things and makes it harder to track this conversation in the future.
Copy link to clipboard
Copied
It's because there are too many watches and I want to be lazy.
I ran into 400 tables the day before yesterday.
So this desire became even more intense.
It's very good to realize the current function.
Thank you very much.
Copy link to clipboard
Copied
Hi Eugene Tyson
How does this script add a row at the top of the table and then merge this empty row?
I have this, but I can't pick it up.
The cursor should be able to be anywhere in the table. Adding a blank row jumps to the first blank row.
//first table in the active document
var table=app.activeDocument.textFrames[0].parentStory.tables[0]
dupeTopRow(table);
table.rows.add(LocationOptions.BEFORE, table.rows[0]);
/**
* duplicate the first row af a table
* @ param the table
* @ return void
*/
function dupeTopRow(t){
var nr = t.rows.add(LocationOptions.BEFORE, t.rows[0]);
var c = nr.cells
var lr = t.rows[1].cells
for (var i = 0; i < c.length; i++){
c[i].properties = lr[i].properties;
};
}
Copy link to clipboard
Copied
I'm not sure what you're asking here.
The way to get a continious header in the table is how I've shown it.
Doing what you need to do is a bit open ended because I don't fully understand what it is you're trying to do.
However, I'm not at the computer right now, and I'm not the best scripter so I might not even be able to do what you want.
I can take a look tomorrow or if you have a specific file that I work with that you can share and explain in detail what you need to happen.
Copy link to clipboard
Copied
Just want to start showing "continue" at the top of the second frame.
Step 1. Select the row that may become the table header (there may be 1 or 2 rows).
2. Add an empty row at the top of the table and merge all cells of this row.
3. Add “Continue” character into this row.
4. Set this row height to 5mm, and apply "Continue" cell style.
5. Change the "step 1 selected rows and Just added row" to the table header.
6 . skip the first page of the table header
Please check the attachment sample
Thanks a lot
Copy link to clipboard
Copied
Copy link to clipboard
Copied
If you can first select cells to be merged - doesn't matter if it's a row or a few cells - this will work:
app.selection[0].merge();
But it won't merge whole rows - if you select a few cells in the middle.
This, will only merge first selected row of the selection:
app.selection[0].parentRow.merge();
keeping the rest of the cells selected:
Copy link to clipboard
Copied
I expressed myself wrongly.
I want to add a new row at the top of the table, and then merge the whole row, and then apply the style and set row height.
Copy link to clipboard
Copied
I expressed myself wrongly.
I want to add a new row at the top of the table, and then merge the whole row, and then apply the style and set row height.
By @dublove
Yes, I know, I've just posted a more simplified version of the @Eugene Tyson's code - without error handling.
Copy link to clipboard
Copied
Thank you very much.
It would be nice if you could automatically add a new row at the top of the table and then work on this row.
You're so energetic.
I'm so sleepy I'm going to bed.
Copy link to clipboard
Copied
How to insert a row at the top of a table while the cursor is still on that row.
Next I can execute the latter script