Hello
I am trying to copy a row from a table and place it directly underneath the row I copied from. Here is the layout of my letter
Table 1 - contains titles etc..
Table 2 - contains the data
Table 3 - contains the totals
I am trying to copy table 2 and place it before table 3 so it looks like this
Table 1 - contains titles etc..
Table 2 - contains the data
Table 2 - contians the data for a second person
Table 3 - contains the totals
However it is doing one of two things.
Here is the code for my first result. When I run this code it places the row I copied into the last cell of row I copied from.
Table 1 - contains titles etc..
Table 2 - contains the dataTable 2 - contians the data for a second person
Table 3 - contains the totals
//'035' is the value in the first cell of the row
if WPRichText_3.Finder.Next('035') then
begin
// once '035' found, go to start of line and start selection
WPRichText_3.Finder.MoveToFoundPositionStart;
if paprIsTable in WPRichText_3.ActiveParagraph.prop then
WPRichText_3.SelectThisRow
else
WPRichText_3.SelectLine;
//'140' is the value in the last cell of the row I copied from
If WPRichText_1.Finder.Next('140') then begin
WPRichText_1.Finder.MoveToFoundPositionEnd;
WPRichText_1.CPPosition :=
WPRichText_1.Finder.FoundPosition;
WPRichText_1.SelectionAsString :=
WPRichText_3.SelectionAsString; // copy in this row
WPRichText_1.ReformatAll;
WPRichText_3.CPPosition := 0;
End;
end;
Here is the code for my second result. When I run this code, it places the row I copied after the very last table in the letter.
Table 1 - contains titles etc..
Table 2 - contains the data
Table 3 - contains the totals
Table 2 - contians the data for a second person
//'035' is the value in the first cell of the row
if WPRichText_3.Finder.Next('035') then
begin
// once '035' found, go to start of line and start selection
WPRichText_3.Finder.MoveToFoundPositionStart;
if paprIsTable in WPRichText_3.ActiveParagraph.prop then
WPRichText_3.SelectThisRow
else
WPRichText_3.SelectLine;
//'140' is the value in the last cell of the row I copied from
If WPRichText_1.Finder.Next('140') then begin
WPRichText_1.Finder.MoveToFoundPositionEnd;
WPRichText_1.CPPosition :=
WPRichText_1.Finder.FoundPosition;
WPRichText_1.ActiveParagraph :=
WPRichText_1.FastAppendParagraph;
WPRichText_1.SelectParagraph
(WPRichText_1.ActiveParagraph);
WPRichText_1.SelectionAsString :=
WPRichText_3.SelectionAsString; // copy in this row
WPRichText_1.ReformatAll;
WPRichText_3.CPPosition := 0;
End;
end;
Can you help me figure out what I am doing wrong?