Append vs Overwrite

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Append vs Overwrite

Postby vpe88 » Mon Sep 10, 2012 9:36 am

Hi experts,

I'm running in Windows 7, DotNet 2010 with VPE v6.10 Professional.

My scenario:
Say VPEFileName is fixed, and I'll never delete the physical file.

Sample CODE:
*************************************************************************************
VPE.Write(......);
VPE.Write(......);
VPE.Write(......);
VPE.Write(......);
VPE.Write(......);

VPEFileName = "C:\HelloWorld.VPE";
VPE.WriteDoc(VPEFileName);
*************************************************************************************

First written to the VPE file has everything gone perfectly.. but for the subsequently writes, every time the content will be appended into the existing one, rather than fully overwritten the content in the VPE file.

Is that something I can do such code instruction to always overwrites the previous contents in the same file name VPE File?
Thanks in advance.
vpe88
 
Posts: 11
Joined: Thu Jun 16, 2011 10:50 am

Re: Append vs Overwrite

Postby IDEAL Software Support » Mon Sep 10, 2012 12:10 pm

This is a feature, which allows to easily assemble multiple documents to a single huge document file. If you do not wish this behavior, simply delete the document file before calling WriteDoc().
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Re: Append vs Overwrite

Postby vpe88 » Mon Sep 10, 2012 2:06 pm

I actually tried the workaround earlier by just added 1 line code to do deletion, but the subsequent VPE.WriteDoc written empty content, the created VPE file is empty.
vpe88
 
Posts: 11
Joined: Thu Jun 16, 2011 10:50 am

Re: Append vs Overwrite

Postby IDEAL Software Support » Tue Sep 11, 2012 11:24 am

When you call WriteDoc( <file-name> ) and there does not exist a file under the given name, a new file is created.

If no file is created, you are doing something wrong. Check permissions, etc.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 7 guests

cron