Can you add an image of a table + selection where this problem shows up? I'm having a hard time picturing it.
Would it be possible to (maybe only temporary) un-merge every cell in the table.
You could then run the content of every cell into an 2 dimensional array. Now you got all data in a "clean" spot.
From here you do you further script.
If this would work for you, I think I got some script fragments where I did lots of cell operations...
let me know
Thanks for your replies
I am going to attach a screenshot shortly
I though of that, but I wasnt sure how to 'remember' where they were to remerge them later on
Do you have any ideas?
I ran a script on my table to insert values into the cells so we can see the issues
Here is a screen shot depicting the problems (I indicated them with red boxes)
Example of the problem:
Look in row A7
Cell A is indexed at 7
Cells B - O are indexed at 6
Cells P - R are indexed at 5!
Row 0 has only 1 cell since they are all merged into the rightmost cell.
Therefore, column B starts 0 in row 2 (instead of row A)
Columns P-R start 0 in row 3 since in row 2 it is merged into cell O0
Again, if anyone can offer some help and advice on this topic, it would be very much appreciated
I just had a look at the code I had in mind. I coded this longer ago then I had in mind -)
I started with an un-merged table and merged cells if they were empty in order for the content to use as little vertical space as possible.
The source of all my tables came from Excel and we used XML to bring some formatting along.
Trouble stared when the client wanted to update the content. If the structure of a table stays, that is the same number of rows and cols all is well.
But if additional rows or cols are coming through. All formatting goes out...
I would potentially duplicate the table, un-merge all cells, maybe still run the data into an Array and go from there.
After that you kill the douplicated table.
BTW: I keept the "clean" Array in a script label attached to the table. So I had a quick way back to the array (cell by cell data) in later operations.
That does cause problems....!
I dont understand how your suggestion will help
I'll explain - if I unmerge all cells, it will result that in the new table all columns will start at the top which is 0
Hence, when I am getting the data for column B, cell B0 will be empty since it will be on the first row (row 0) - cell B1 will have the contents "B0"
When I go back to the original chart and try to insert the data for B0 into cell B1 (as displayed in the screenshot above) - it wont come out there, rather in the next row
I see you problem. Sorry leading you down this path...
I understand you need to "remember" where the cells are merged to write your results back into the table.
Why do you need to know the row indexes? Isn't parentRow getting you to the correct row? I've tried to recreate this but I can't see the problem. Maybe you can post a little more of your code so it's clearer where exactly the mismatch is.
I tried that and it didnt work - it returned the wrong row......
But now that you mentioned it.... I tried it again and IT DID WORK!
I dont know what happened last time - but now its working
Sorry for the inconvenience
Thanks for the help