Copy link to clipboard
Copied
If a table uses "Skip Header Row on Page 1" feature,
but the table only takes up 1 page (or 1 column), It will lead to duplication in the table of contents.
Waiting for an official fix for this bug may be too long.
Is there a script to find these tables and then unskip the page 1 header rows?
Initially it may have been correctly needed.
They didn't take up 2 pages (2 columns) later because the layout moved.
But you don't know which ones made the setting
Alright - maybe something like this
Before running the script on a large or important document, test it on a smaller sample file to ensure it works as expected. Save a backup of your document as a precaution.
This is just and idea, maybe it does what you want and maybe not, but hopefully it can be refined or used as foundation going forward.
// Loop through all tables in the active document
var tables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
for (var i = 0; ...
// Loop through all tables in the active document
var myTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
var T = myTables.length, t;
for ( t = 0; t < T; t++ ) {
var myTable = myTables[t];
if ( myTable.storyOffset.textColumns[0] != myTable.storyOffset.paragraphs[0].insertionPoints[-1].textColumns[0] ) {
myTable.select();
alert( "Do Something! ... What? No idea!!!" )
}
}
(^/)
Copy link to clipboard
Copied
Now it's right within two pages.
If the table spans more than 3 pages, it is incorrect
Copy link to clipboard
Copied
I've uploaded a new, clearer sample file
There are just have multiple cases.
There are tables that span multiple pages and tables that span two columns.
There are tables that originally span pages and then don't.
Those that originally had skipFirstHeader set, and then didn't span pages, resulting in duplicate items when extracting the catalog.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Yeh I can't figure that out.
Copy link to clipboard
Copied
Yeh I can't figure that out.
By @Eugene Tyson
Figure out what? There is ALWAYS a way to skin a cat š
Please quote message you're replying to - this forum is a mess.
Copy link to clipboard
Copied
Although I haven't thought about it. Why change it to "! = "can be recognized?
I'd like to settle for that.
But then I realized that when spanning multiple pages, I would delete the first row by mistake.
I've updated the sample again (Skip A1 A2 B1 B2--B3.IDML)
Copy link to clipboard
Copied
My guess is that the correct parentage was not found.
Right now it's right up to two pages, but wrong over 3 pages.
Copy link to clipboard
Copied
// Place The Cursor Inside A Table Cell:
if ( app.selection[0].parent.constructor.name != "Cell" ) {
alert( "Place The Cursor Inside A Table Cell! ..." )
exit();
} else {
var myTable = app.selection[0].parent.parent;
if ( myTable.storyOffset.parentTextFrames[0] != myTable.storyOffset.paragraphs[0].insertionPoints[-1].parentTextFrames[0] ) {
if ( myTable.storyOffset.parentTextFrames[0].parentPage === myTable.storyOffset.paragraphs[0].insertionPoints[-1].parentTextFrames[0].parentPage ) alert( "1a/ Table on 2 text frames and 1 page" )
else alert( "1b/ Table on " + Number( (myTable.storyOffset.paragraphs[0].insertionPoints[-1].parentTextFrames[0].parentPage.documentOffset - myTable.storyOffset.parentTextFrames[0].parentPage.documentOffset) + 1) + " pages" )
} else if ( myTable.storyOffset.textColumns[0] != myTable.storyOffset.paragraphs[0].insertionPoints[-1].textColumns[0] && myTable.storyOffset.parentTextFrames[0].parentPage === myTable.storyOffset.paragraphs[0].insertionPoints[-1].parentTextFrames[0].parentPage ) alert( "2/ Table on 2 columns and 1 page" )
else alert( "3/ Table on 1 column on 1 page" )
}
(^/)
Copy link to clipboard
Copied
You are making a lot of assumptions - what if there are multiple TFs on the same page? What if there are "empty" pages in the middle of the spanned Table? What if Table is in three text column TextFrame? etc.
Copy link to clipboard
Copied
More compact:
// Place The Cursor Inside A Table Cell:
if ( app.selection[0].parent.constructor.name != "Cell" ) {
alert( "Place The Cursor Inside A Table Cell! ..." )
exit();
} else {
var myTable = app.selection[0].parent.parent;
if ( myTable.storyOffset.textColumns[0] === myTable.storyOffset.paragraphs[0].insertionPoints[-1].textColumns[0] ) alert( "Good! Table on 1 column on 1 page" )
else alert( "Bad! All the other cases ..." )
}
(^/)
Copy link to clipboard
Copied
Place The Cursor Inside A Table Cell?
Targets all tables in the entire document, not selecting a particular table. It is traversing all tables.
Copy link to clipboard
Copied
// Loop through all tables in the active document
var myTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
var T = myTables.length, t;
for ( t = 0; t < T; t++ ) {
var myTable = myTables[t];
if ( myTable.storyOffset.textColumns[0] != myTable.storyOffset.paragraphs[0].insertionPoints[-1].textColumns[0] ) {
myTable.select();
alert( "Do Something! ... What? No idea!!!" )
}
}
(^/)
Copy link to clipboard
Copied
Hi FRIdNGE,,
Thank you very much.
That should do it. I tried it last night.
Just not var T = myTables.length, t;
for ( t = 0; t < T; t++ ) {
var myTable = myTables[t];
This paragraph.
What does myTables.length mean?
The number of all tables? It can also be expressed like this ......
Copy link to clipboard
Copied
Copy link to clipboard
Copied
No problems found except that it doesn't work when it contains overflow text
No other problems were found.
Only 1 column or 1 page. But there is an overflow
== correspondsćmyTable.skipFirstHeader = false;
or
!= correspondsćmyTable.skipFirstHeader = true;
All failing.
----------------------Below is the code for the test--------------------
// Loop through all tables in the active document
var myTables = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
var T = myTables.length, t;
for ( t = 0; t < T; t++ ) {
var myTable = myTables[t];
if ( myTable.storyOffset.textColumns[0]== myTable.storyOffset.paragraphs[0].insertionPoints[-1].textColumns[0] ) {
//myTable.select();
myTable.skipFirstHeader = false;
//alert( "Do Something! ... What? No idea!!!" )
}
}
Copy link to clipboard
Copied
Because in case of overflow text - main text, the Table is in - last InsertionPoint is in overset - so doesn't have parentTextFrames nor TextColumns.
Copy link to clipboard
Copied
Always the same question:
Why do you want to change the "skipFirstHeader" option as "false" to these 2 tables?
(^/)
Copy link to clipboard
Copied
Hi FRIdNGE
As I said before.
At the beginning of the layout, there are some table span pages (or columns), so set āskipFirstHeader = trueā
But then, because of content changes, some tables didn't span pages (or columns). You have to change these tables to āskipFirstHeader = falseā.
Otherwise, the catalog (contents) you extracted, will have duplicate items.
This is a big bug.
Copy link to clipboard
Copied
Otherwise, the catalog (contents) you extracted, will have duplicate items.
This is a big bug.
By @dublove
No, it's not, it's just your specific layout / design.
Copy link to clipboard
Copied
Duplicate entries occur in the extraction catalog.
This is not a problem I've run into alone.
A lot of people have run into it and gotten yelled at by their customers.
I have studied it over a long period of time.
It was found to be caused by skipping the table header on page 1.
I never want to write a script for a trope.
My requests are universally applicable to most operations.
Copy link to clipboard
Copied
You HAVE to change your approach to working in InDesign.
First, before you start automating things - make sure that there are no oversets - either visually or by using preflight - or with a script.
ONLY THEN you can successfully run scripts.
Then, as I've pointed out already - remove "extra" rows added by earlier script or 1st run of the same script - before you run additional scripts that would be affected by those "extra" rows - or columns, whatever.
Because, right now, you're repeating the same "problem" over and over again - providing us with broken examples.
Copy link to clipboard
Copied
Yes, I'm changing.
I'm always uncomfortable inside when a problem isn't solved.
Copy link to clipboard
Copied
Hi FRIdNGE
How do I output the page number where the above condition occurs?
Output all page numbers at once.
I want to check one page at a time.
Thank you very much.
Copy link to clipboard
Copied
Let's reset everything - because, I think, we went into a rabbit hole - are you doing your documents for print or for ePUB / accessibility - or both?
Because, I'm pretty sure there is / are much easier way(s) to solve your "problems" - and you're "trying too hard" to accomplish everything at once.
Copy link to clipboard
Copied
Because, I'm pretty sure there is / are much easier way(s) to solve your "problems" - and you're "trying too hard" to accomplish everything at once.
By @Robert at ID-Tasker
I also think you're way better off. Well hope you can share.
I've been waiting for you 10,000 years.
It is usually used for printing.
Interactive output is only used for proofreading. It can be disregarded.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now