How to make a copy of the current VPE

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

How to make a copy of the current VPE

Postby JensB » Thu Jul 19, 2007 4:52 am

Hi,

i try to do this with VPE 3.6 under Delphi-VCL:
- create pages in VPE
- copy VPE to another VPE (VPE_Copy := VPE)
- make changes in the new VPE

what happens:
- copying source-VPE into destination-VPE works
- making changes in the destination-VPE works
but:
after modifying the destination-VPE, the souce-VPE has the same content as the destination-VPE!

There's absolute no code in my source, that copy the destination-VPE back to source-VPE.

My question:
Is this a bug or is it not possible to get a copy of the current VPE to make changes only to the destination-VPE?

Thanks for help
Jens Burmester
JensB
 
Posts: 1
Joined: Thu Jul 19, 2007 4:36 am

Postby IDEAL Software Support » Thu Jul 19, 2007 9:07 am

First of all, the problem you are facing is related to Object Pascal. The assignment operator of Object Pascal does not copy the contents of an object, it just copies the pointer to an object. Therefore, with "VPE_Copy := VPE" you make "VPE_Copy" point to the same document as "VPE". The := assignment operator of Object Pascal can not do what you intend to do.

The TPersistent class provides the methods Assign() and AssignTo() which could be used for copying objects, but VPE is not derived from TPersistent but from TCustomControl - as all visual components of the VCL.

Furthermore the VPE VCL component encapsulates the VPE-DLL and the DLL does not offer a direct method to copy a document. But you can use WriteDoc() and ReadDoc() to create copies of documents. With VPE v4.0 you can do this in memory, using the new memory streams, and you can also write and read specific page ranges.

Regards
Thorsten Radde
IDEAL Software GmbH
IDEAL Software Support
 
Posts: 1622
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 87 guests

cron