This content has been marked as final. Show 6 replies
The same problem also happens if I use an other way to insert data :
var cell = table.cells;
cell.texts.item(0).contents = "existe en 4,57 x 1,07 m";
To be more precise :
after inserting the "bad" text (which works), the variable that references my table becomes null.
But when inserting a non-failing text, I don't lose my reference, of course.
The problem seems related to spaces : when I removed all spaces from my string, everything works fine. The same happens with other "bad" strings
I found what the problem was :
inserting text (with spaces) was sometimes increasing the cell height ; when this cell height was bigger than parent textframe height, the table became hidden (inside the textframe) and then unaccessible.
This is where I think InDesign is really not fair : myTextFrame.tables.length == 0 if the table cannot be seen because of vertical overflow !!!
re: "This is where I think InDesign is really not fair : myTextFrame.tables.length == 0 if the table cannot be seen because of vertical overflow !!!"
I disagree. If the table does not appear in the text frame, then it shouldn't be in the text frame object. If the table appeared as a child of the text frame when it does nto appear in the frame (when it might have moved to another text frame in the story), it would be even more confusing.
This points out the danger of relying on the text frame as the container--instead, use the parent story of the text frame, which will contain all of the text in the story, regardless of whether it's visible or not.
You're right, using the textframe's parent story is more reliable.
Event if I'm used to rely on the story for pure text management in textframes, I didn't think to do the same for tables.