Applies to
TWPRTFDataBlock
Declaration
function AppendParCopy(var SourcePar: TParagraph; SkipObjects: TWPTextObjTypes = []; AfterPar: TParagraph = nil): TParagraph;
Description
The function AppendParCopy copies one paragraph to this data object. You can pass an object which holds control information, such as "first created paragraph", "last created paragraph" if you want to perform some operation with the newly created text.
Please note:
If SourcePar is a table object (ParagraphType = wpIsTable) then the complete table will be copied. If the SourcePar is a table row (ParagraphType = wpIsTableRow) then this row will be copied. If required, a new table will be created at the destination.
The function changes SourcePar to the next paragraph which must be copied to eventually copy the complete text and returns the reference to the last paragraph which actually was copied
The property SkipObjects can be used to avoid the copying of the embedded objects, such as the mail merge fields with SkipObjects=[wpObjInsertPoint]
Example: Append the complete text except for header and footer
var par : TParagraph;
par := WPRichText1.FirstPar;
while WPRichText2.ActiveText.AppendParCopy(par,[])<>nil do ;
WPRichText2.ReformatAll; |
Copy only Tables: while par<>nil do
begin
if par.ParagraphType=wpIsTable then
Dest.ActiveText.AppendParCopy(par)
else par := par.NextPar;
end; |
Copy only tables and in tables only the non empty lines (uses par.ContainsText!) par := Source.FirstPar;
while par<>nil do
begin
if par.ParagraphType=wpIsTable then
begin
npar := par.RowFirst;
while npar<>nil do
begin
// Checks if the paragraph and sub paragraphs contain any text
if npar.ContainsText then
Dest.ActiveText.AppendParCopy(npar)
else npar := npar.NextPar;
end;
par := par.NextPar;
end
else par := par.NextPar;
end; |
Category
Copy Text
|
Copyright (C) by WPCUBED GmbH - Munich
|
http://www.wpcubed.com