Copy link to clipboard
Copied
Is it another bug ?
When loading info from AllPageItems of the Document - I'm getting duplicates of ALL Rectangles and their Images - when Table is inside another Table.
And it's getting worse - every extra nesting - duplicates everything again - Table nside a Table inside another Table:
Everything is perfectly fine when there is no nesting - Table is just inside a Text.
Can someone please check if you have the same ?
Copy link to clipboard
Copied
Hi @Robert at ID-Tasker, you really need to show us the exact steps to reproduce what you are seeing.
For example, here's what I did just now, manually:
1. new Indesign document, 1 page, no primary textframe
2. make text frame
3. insert new table (2 x 2) into textframe 0 at insertionPoint 0
4. convert cell 0 of table 0 to a graphic cell
5. place an image into cell 0 of table 0
6. insert new table (2 x 2) into cell 1 of table 0 at insertionPoint 0
7. convert cell 0 of table 1 to a graphic cell
8. place an image into cell 0 of table 1
9. run script:
var items = app.activeDocument.allPageItems;
for (var i = 0; i < items.length; i++)
$.writeln(items[i].toSpecifier());
Result:
/document[@id=36]//text-frame[@id=220]
/document[@id=36]//rectangle[@id=252]
/document[@id=36]//image[@id=253]
/document[@id=36]//rectangle[@id=271]
/document[@id=36]//PDF[@id=272]
This is exactly the result I expected. I have probably misunderstood your case and, if so, please outline the exact steps (and make it as minimal as possible).
- Mark
Copy link to clipboard
Copied
Thanks for your reply @m1b.
I'm not modifying nor creating anything - I'm just reading a structure of a document.
Cells are not graphics - they have inline graphics with text - kind of icons with text.
When the table is in the "normal" text - there is no problem.
But when the table with those icons - is placed in another table - to simulate 3x column text - there are two more tables - ALL "icons" get duplicated - and if then manually nest this "Table inside Table" into another table - all icons are duplicated again.
My initial thought was that there is a problem with the original INDD file - so I've copied nested Table into a new document - icons not duplicated.
So then I've copied this 3x column table with nested Tables - icons duplicated.
Then I've nested everything again... have not tried again 😉 but I'm sure it would get duplicated again... 1x, 2x, 4x...
So it looks like a bug to me...
Copy link to clipboard
Copied
Robert, the point I'm making is that to describe a bug, you need to itemise the steps to (re)produce it. For example, we have no idea whether there is something malformed about your table that you are copying/pasting. Even if you share your example document, we don't know whether there is a corruption in it, or a weird process went into its creation.
So if you want to describe, and report, a bug, you must write the steps to reproduce it, starting from a known foundation, such as Indesign with no documents open. My example should give you a good guide.
Otherwise, there isn't much for us to do to help you. We can't follow what you did because we don't know *everything* about your document and we don't know how you derived your spreadsheet data—for all we know that could be the faulty part. See what I mean?
But more importantly, if you want help here, you simply have to do as much work as possible yourself. Make it as easy as possible for everyone else to help you. As it stands you have given us a vague, messy, impossible task, with no example files or code.
In contrast, if you have written out steps like I did then anyone reading this could follow along, with almost no room for error, and say: yes I got the same (presumably buggy) result and you could lodge a bug at indesign uservoice using your reproducable steps.
But if *you* cannot reproduce the bug, then there is nothing to do here. So far we have no evidence that you can reproduce the bug yourself, because you have not taken the effort to outline the steps to reproduce it.
I am saying this in the spirit of helping you learn how to lodge bugs, and get better help on the forum.
- Mark
Copy link to clipboard
Copied
Sorry 😉 I'm always using too many shortcuts 😉
Here is a result of your script:
/document[@id=2]//text-frame[@id=221]
/document[@id=2]//rectangle[@id=396]
/document[@id=2]//image[@id=397]
/document[@id=2]//rectangle[@id=388]
/document[@id=2]//image[@id=389]
/document[@id=2]//rectangle[@id=379]
/document[@id=2]//image[@id=380]
/document[@id=2]//rectangle[@id=372]
/document[@id=2]//image[@id=373]
/document[@id=2]//rectangle[@id=364]
/document[@id=2]//image[@id=365]
/document[@id=2]//rectangle[@id=345]
/document[@id=2]//image[@id=346]
/document[@id=2]//rectangle[@id=337]
/document[@id=2]//image[@id=338]
/document[@id=2]//rectangle[@id=329]
/document[@id=2]//image[@id=330]
/document[@id=2]//rectangle[@id=300]
/document[@id=2]//image[@id=301]
/document[@id=2]//rectangle[@id=291]
/document[@id=2]//image[@id=292]
/document[@id=2]//rectangle[@id=284]
/document[@id=2]//image[@id=285]
/document[@id=2]//rectangle[@id=275]
/document[@id=2]//image[@id=276]
/document[@id=2]//rectangle[@id=267]
/document[@id=2]//image[@id=268]
/document[@id=2]//rectangle[@id=396]
/document[@id=2]//image[@id=397]
/document[@id=2]//rectangle[@id=388]
/document[@id=2]//image[@id=389]
/document[@id=2]//rectangle[@id=379]
/document[@id=2]//image[@id=380]
/document[@id=2]//rectangle[@id=372]
/document[@id=2]//image[@id=373]
/document[@id=2]//rectangle[@id=364]
/document[@id=2]//image[@id=365]
/document[@id=2]//rectangle[@id=345]
/document[@id=2]//image[@id=346]
/document[@id=2]//rectangle[@id=337]
/document[@id=2]//image[@id=338]
/document[@id=2]//rectangle[@id=329]
/document[@id=2]//image[@id=330]
/document[@id=2]//rectangle[@id=300]
/document[@id=2]//image[@id=301]
/document[@id=2]//rectangle[@id=291]
/document[@id=2]//image[@id=292]
/document[@id=2]//rectangle[@id=284]
/document[@id=2]//image[@id=285]
/document[@id=2]//rectangle[@id=275]
/document[@id=2]//image[@id=276]
/document[@id=2]//rectangle[@id=267]
/document[@id=2]//image[@id=268]
Result: undefined
As you can see - it's duplicated.
And this is how the document looks like:
Dotted lines - "outer" Table - solid lines - "nested" Tables.
Copy link to clipboard
Copied
And here is when everything is nested again 😉
/document[@id=2]//text-frame[@id=221]
/document[@id=2]//rectangle[@id=954]
/document[@id=2]//image[@id=955]
/document[@id=2]//rectangle[@id=946]
/document[@id=2]//image[@id=947]
/document[@id=2]//rectangle[@id=936]
/document[@id=2]//image[@id=937]
/document[@id=2]//rectangle[@id=929]
/document[@id=2]//image[@id=930]
/document[@id=2]//rectangle[@id=921]
/document[@id=2]//image[@id=922]
/document[@id=2]//rectangle[@id=903]
/document[@id=2]//image[@id=904]
/document[@id=2]//rectangle[@id=895]
/document[@id=2]//image[@id=896]
/document[@id=2]//rectangle[@id=887]
/document[@id=2]//image[@id=888]
/document[@id=2]//rectangle[@id=868]
/document[@id=2]//image[@id=869]
/document[@id=2]//rectangle[@id=859]
/document[@id=2]//image[@id=860]
/document[@id=2]//rectangle[@id=852]
/document[@id=2]//image[@id=853]
/document[@id=2]//rectangle[@id=842]
/document[@id=2]//image[@id=843]
/document[@id=2]//rectangle[@id=834]
/document[@id=2]//image[@id=835]
/document[@id=2]//rectangle[@id=954]
/document[@id=2]//image[@id=955]
/document[@id=2]//rectangle[@id=946]
/document[@id=2]//image[@id=947]
/document[@id=2]//rectangle[@id=936]
/document[@id=2]//image[@id=937]
/document[@id=2]//rectangle[@id=929]
/document[@id=2]//image[@id=930]
/document[@id=2]//rectangle[@id=921]
/document[@id=2]//image[@id=922]
/document[@id=2]//rectangle[@id=903]
/document[@id=2]//image[@id=904]
/document[@id=2]//rectangle[@id=895]
/document[@id=2]//image[@id=896]
/document[@id=2]//rectangle[@id=887]
/document[@id=2]//image[@id=888]
/document[@id=2]//rectangle[@id=868]
/document[@id=2]//image[@id=869]
/document[@id=2]//rectangle[@id=859]
/document[@id=2]//image[@id=860]
/document[@id=2]//rectangle[@id=852]
/document[@id=2]//image[@id=853]
/document[@id=2]//rectangle[@id=842]
/document[@id=2]//image[@id=843]
/document[@id=2]//rectangle[@id=834]
/document[@id=2]//image[@id=835]
/document[@id=2]//rectangle[@id=954]
/document[@id=2]//image[@id=955]
/document[@id=2]//rectangle[@id=946]
/document[@id=2]//image[@id=947]
/document[@id=2]//rectangle[@id=936]
/document[@id=2]//image[@id=937]
/document[@id=2]//rectangle[@id=929]
/document[@id=2]//image[@id=930]
/document[@id=2]//rectangle[@id=921]
/document[@id=2]//image[@id=922]
/document[@id=2]//rectangle[@id=903]
/document[@id=2]//image[@id=904]
/document[@id=2]//rectangle[@id=895]
/document[@id=2]//image[@id=896]
/document[@id=2]//rectangle[@id=887]
/document[@id=2]//image[@id=888]
/document[@id=2]//rectangle[@id=868]
/document[@id=2]//image[@id=869]
/document[@id=2]//rectangle[@id=859]
/document[@id=2]//image[@id=860]
/document[@id=2]//rectangle[@id=852]
/document[@id=2]//image[@id=853]
/document[@id=2]//rectangle[@id=842]
/document[@id=2]//image[@id=843]
/document[@id=2]//rectangle[@id=834]
/document[@id=2]//image[@id=835]
/document[@id=2]//rectangle[@id=954]
/document[@id=2]//image[@id=955]
/document[@id=2]//rectangle[@id=946]
/document[@id=2]//image[@id=947]
/document[@id=2]//rectangle[@id=936]
/document[@id=2]//image[@id=937]
/document[@id=2]//rectangle[@id=929]
/document[@id=2]//image[@id=930]
/document[@id=2]//rectangle[@id=921]
/document[@id=2]//image[@id=922]
/document[@id=2]//rectangle[@id=903]
/document[@id=2]//image[@id=904]
/document[@id=2]//rectangle[@id=895]
/document[@id=2]//image[@id=896]
/document[@id=2]//rectangle[@id=887]
/document[@id=2]//image[@id=888]
/document[@id=2]//rectangle[@id=868]
/document[@id=2]//image[@id=869]
/document[@id=2]//rectangle[@id=859]
/document[@id=2]//image[@id=860]
/document[@id=2]//rectangle[@id=852]
/document[@id=2]//image[@id=853]
/document[@id=2]//rectangle[@id=842]
/document[@id=2]//image[@id=843]
/document[@id=2]//rectangle[@id=834]
/document[@id=2]//image[@id=835]
Result: undefined
Black lines - nested inside red dots then nested inside green lines.
Copy link to clipboard
Copied
And now even more strange ...
/document[@id=3]//text-frame[@id=240]
/document[@id=3]//rectangle[@id=288]
/document[@id=3]//image[@id=282]
/document[@id=3]//rectangle[@id=289]
/document[@id=3]//image[@id=290]
/document[@id=3]//rectangle[@id=288]
/document[@id=3]//image[@id=282]
/document[@id=3]//rectangle[@id=289]
/document[@id=3]//image[@id=290]
/document[@id=3]//rectangle[@id=289]
/document[@id=3]//image[@id=290]
/document[@id=3]//rectangle[@id=289]
/document[@id=3]//image[@id=290]
Result: undefined
From something like this:
Now it looks like one image has been duplicated 2x - but another - 4x ??
So it depends on the Cell the imagee is in ??
==================
No, it looks like when I've "placed" 1st icon - I've used CTRL+D - so it looks like cell has been converted to a Graphics cell.
After deleting it and Copy&Paste'ing - everything is quadrupled again.
Copy link to clipboard
Copied
Thankyou @Robert at ID-Tasker, that's excellent. Now just one more step: please write out a step-by-step instructions starting from no document open, and showing at which point the script will start showing duplicate ids. For example in my simple case I didn't use copy/paste, so perhaps copy/pasting causes this behaviour? That's why I need to know the steps exactly.
Copy link to clipboard
Copied
So the steps are:
And the result of the script is:
/document[@id=3]//text-frame[@id=240]
/document[@id=3]//rectangle[@id=301]
/document[@id=3]//image[@id=302]
/document[@id=3]//rectangle[@id=289]
/document[@id=3]//image[@id=290]
/document[@id=3]//rectangle[@id=301]
/document[@id=3]//image[@id=302]
/document[@id=3]//rectangle[@id=289]
/document[@id=3]//image[@id=290]
/document[@id=3]//rectangle[@id=301]
/document[@id=3]//image[@id=302]
/document[@id=3]//image[@id=290]
/document[@id=3]//rectangle[@id=289]
/document[@id=3]//rectangle[@id=301]
/document[@id=3]//image[@id=302]
/document[@id=3]//rectangle[@id=289]
/document[@id=3]//image[@id=290]
Result: undefined
Copy link to clipboard
Copied
Again excellent! I've reproduced your findings and here's my slightly simplified steps:
1. new Indesign document, 1 page, no primary textframe
2. make text frame
3. insert new table (2 x 2) into textframe 0 at insertionPoint 0
4. insert new table (2 x 2) into cell 0 of table 0 (from step 3) at insertionPoint 0
5. insert new table (2 x 2) into cell 0 of table 1 (from step 4) at insertionPoint 0
8. place an image into cell 0 of table 2 (from step 5) - this will convert cell 0 to graphic cell
9. run script:
var items = app.activeDocument.allPageItems;
for (var i = 0; i < items.length; i++)
$.writeln(items[i].toSpecifier());
Expected result:
/document[@id=38]//text-frame[@id=239]
/document[@id=38]//rectangle[@id=361]
/document[@id=38]//image[@id=353]
Actual result:
/document[@id=38]//text-frame[@id=239]
/document[@id=38]//rectangle[@id=361]
/document[@id=38]//image[@id=353]
/document[@id=38]//rectangle[@id=361]
/document[@id=38]//image[@id=353]
So, yes, you have found a bug! Using the information above, as well as your version and platform info, you can go and lodge the bug.
Edit: here is my screen:
Cyan is table 0, magenta is table 1, green is table 2.
Edit 2023-03-01: attached .indd.
Copy link to clipboard
Copied
But it should be:
/document[@id=1]//text-frame[@id=246]
/document[@id=1]//rectangle[@id=286]
/document[@id=1]//image[@id=282]
/document[@id=1]//rectangle[@id=286]
/document[@id=1]//image[@id=282]
/document[@id=1]//rectangle[@id=286]
/document[@id=1]//image[@id=282]
/document[@id=1]//rectangle[@id=286]
/document[@id=1]//image[@id=282]
Result: undefined
Each nesting doubles the number of items - or as per your point 8th - your cell is a Graphic Cell so one nesting is ignored ?
Copy link to clipboard
Copied
There is only one text frame, one rectangle and one image. So I would expect to see just those three items. Note that that is exactly what I did see with only one nested table (two tables total). So the bug only appears after the second table nesting.
Copy link to clipboard
Copied
But you have 3x tables?
If you place your image into Graphic Cell - auto-conversion after Ctrl+D - then 1st nesting is ignored.
But if you place image as InLine with text - after space - then it doubles after 1sr nesting.
Each additional nesting doubles again and again...
Copy link to clipboard
Copied
Okay, but for the sake of lodging the bug, I have itemised the simplest case where the bug appears. I don't think there's any need to make it more complicated as I'm pretty sure it is the same bug. But you could lodge both as bugs to be sure, or it might be better to just include both examples in the bug report.
Copy link to clipboard
Copied
@m1b said: "Again excellent! I've reproduced your findings and here's my slightly simplified steps:"
Hi Mark,
I followed your steps where you and I expected only three items in the document.
One text frame holding the table.
One rectangle inside the graphic cell.
The image inside that rectangle.
All in all with my test document it is working as expected:
app.documents[0].spreads[0].allPageItems.length returns 3
app.documents[0].allPageItems.length returns 3
My code:
var allPageItems = app.documents[0].allPageItems;
var allPageItemsLength = allPageItems.length;
var idArray = [];
for( var n=0; n<allPageItemsLength; n++ )
{
idArray[n] = allPageItems[n].id +"\t"+ allPageItems[n].constructor.name;
};
alert( "List of Items" +"\r"+ idArray.join("\r") );
The result:
Attached my test document:
TestDoc-UWE-3-pageItems.indd
Mark, could you make your InDesign document available?
All my tests done with InDesign 2023 version 18.1 ( on macOS this time ) .
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
Because when you've placed your image "directly" - Cell been converted to a Graphic Cell.
If you place your image as InLine - with text - so the Cell remains as a Text Cell - then you'll get duplicates.
Copy link to clipboard
Copied
Hi Robert,
thanks for the hint. Indeed if I anchor the image to an insertion point of the inner cell of the inner table two objects are doubled in the allPageItems array of the document:
Test document attached:
TestDoc-UWE-Table-ImageAnchored.indd
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
Yes, we've discussed this already with @m1b 😉
And every additional nesting - doubles it again - in geometric progression 😞
At least easy for me to remove those duplicates in my tool 😉
Copy link to clipboard
Copied
@Robert at ID-Tasker would you like me to lodge this bug? Or would you like to do it?
Copy link to clipboard
Copied
Done it yesterday.
Copy link to clipboard
Copied
So, I can confirm same result as @Robert at ID-Tasker and @Laubender. Steps to reproduce bug as per @Robert at ID-Tasker's observation:
1. new Indesign document, 1 page, no primary textframe
2. make text frame
3. insert new table (2 x 2) into textframe 0 at insertionPoint 0
4. insert new table (2 x 2) into cell 0 of table 0 (from step 3) at insertionPoint 0
5. paste an image into text of cell 0 of table 1 (from step 4) - anchored object
6. run script:
var items = app.activeDocument.allPageItems;
for (var i = 0; i < items.length; i++)
$.writeln(items[i].toSpecifier());
Expected result:
/document[@id=8]//text-frame[@id=239]
/document[@id=8]//rectangle[@id=381]
/document[@id=8]//image[@id=377]
Actual result:
/document[@id=8]//text-frame[@id=239]
/document[@id=8]//rectangle[@id=381]
/document[@id=8]//image[@id=377]
/document[@id=8]//rectangle[@id=381]
/document[@id=8]//image[@id=377]
See attached sample .indd document.
Copy link to clipboard
Copied
Thanks @Laubender , here is inspired version from your script for more long document :
//List All Document Items ID and Constructor Name
myList="";
var allPageItems = app.documents[0].allPageItems;
var allPageItemsLength = allPageItems.length;
var idArray = [];
for( var n=0; n<allPageItemsLength; n++ )
{
idArray[n] = allPageItems[n].id +"\t"+ allPageItems[n].constructor.name+"\r";
myList+=idArray[n];
};
alert_scroll ( "List of Items", [myList]);
function alert_scroll (title, input){
if (input instanceof Array)
input = "ID"+"\t"+"Item Name"+"\r"+input.join ("\r");
var w = new Window ("dialog", title);
var list = w.add ("edittext", undefined, input, {multiline: true, scrolling: true});
list.maximumSize.height = w.maximumSize.height-100;
list.minimumSize.width = 300;
w.add ("button", undefined, "Close", {name: "ok"});
var myGrepFoundPreview = [];
w.show ();
}
Copy link to clipboard
Copied
Hi Robert,
don't know if this issue will ever get fixed.
I can already see the same behavior with allPageItems and anchored objects in nested tables in InDesign CS6 version 8.1.
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
Great 😞
But like I've said - not a big deal for my tool 🙂 but you guys using JS - need to remember about it 😞