Function TParagraph.GetChildrenAsList : TWPParagraphList
Unit: WPRTEDefs
Class: WPRTEDefs.TParagraph
Returns
The type of the result value is TWPParagraphList.
Description
This procedure creates a TWPParagraphList instance and moves all children paragraphs to this list. This procedure can be used to sort rows in a table. WithExample - sort the rows in a table:
function RowCompare(Item1, Item2: Pointer): Integer;
begin
Result:=TParagraph(Item1).ColFirst.ComparePar(
TParagraph(Item2).ColFirst);
end;
procedure TForm1.SortCurrentTable;
var list : TWPParagraphList;
aTable : TParagraph;
begin
aTable:=WPRichText1.Table;
if aTable<>nil then
begin
list:=aTable.GetChildrenAsList;
list.Sort(RowCompare);
aTable.SetChildrenFromList(list);
list.Free;
end;
end;