I need to join the selection using TfrxTableObject.JoinSelection using a loop but I am missing the gap/shift/difference when doing so. So far, I managed to join the first 2 cells but after that the aforementioned gap shifts everything. Note: I know this is easy but I seem to be stuck.
Input:
Title |
---|
A |
A |
(null) |
B |
B |
B |
(null) |
C |
C |
C |
C |
Output:
Title |
---|
A |
(null) |
B |
(null) |
C |
There is no gap.
var
tb : frxtableobject1;
i, total : integer;
s, ls : string;
begin
tb := frxReport1.FindObject('tb') as tfrxtableobject;
i := 0;
total := 0;
ls := '';
repeat
if i < 11 then s := tb.Cells[0,i].Text;
if (s = ls) and (i < 12) then
begin
inc(total);
end
else
begin
if total > 0 then
if ls <> '' then
tb.JoinSelection(0,i-1-total,0,i-1);
total := 0;
end;
ls := s;
inc(i);
until i > 12;
end;