Merged Cells confuse the counter
Hello community,
thanks in advance for any help, idea, comment!
I have a weird issue: I browse via a JScript through a table in InDesign to update prices given by a .csv.
To do so,
- I search for a Part-Nr given by the .csv and draw the indexes (parentRow, parentColumn) from the matching cell
- then I jump one cell to the right and place the new price (also given by the csv)
That works fine, AS LONG AS there are no merged cells in the row involved. If there are merged cells, then the search-response is correct, but when I try to place the right price, it jumps one cell too far (because earlier in the row, two cells are merged to one cell). The funny thing is, that when I ask for parentColumn of the cell, where the price should land, the answer is right. But when I then try to place new content in exact this cell using the coordinates just given, it jumps one cell further as wanted???
Here the code-piece that is inflicted:
app.findTextPreferences.findWhat = "Part-Nr given from the csv";
var myHit = myDoc.findText();
if(myHit.length > 0){
myCell = myHit[0].parent;
myCell.parentRow.cells[myCell.parentColumn.index+1].contents = "Price given from the csv";
}
Anyone an idea what causes that behaviour and what I can do to avoid it?
Thanks a lot!
Kosta