Is there a way to append one doc content to another other that AppendAsSection

  • Hello,

    For test purposes I use the following simple code to append one document to another several times:

    1.   for var i: System.Integer := 1 to Count do
    2.   begin
    3.     doc1.CPPosition := $FFFFFFF;
    4.     doc1.AppendAsSection(doc2);
    5.     doc1.ReformatAll;
    6.   end;

    The result document looks as expected - all content is appended as sections.

    But I wonder is there another way to append - not as sections?

    Because currently if I want to change (for example) orientation of the result document in MS Word I have to Select All first and then change the orientation. Otherwise the orientation is changed only for a section.


  • Thanks , it works :)

    I have another question related to performance of appending.

    I've done the following test:

    1. Load doc2 from file

    2. Append 100 times to doc1 (which is empty)

    The code is in my fist post. I've tried also with LoadFromStream() at cursor position.

    I noticed that:

    - If I load the content from .rtf-file the time is about 6 minutes (on my computer)

    - If I load the content from .docx-file the time is about 1 second (on my computer)

    Is it possible the reason to be only the format differences ?

    Maybe I am missing some specific setting that affects the performance.