Word temporary scratch file limit

  • Thread starter Ravishankar Purushothaman
  • Start date
R

Ravishankar Purushothaman

Hello,
I have a WORD XP COM Addin that is used to generate reports. During the
generation of a report, the COM Addin does a lot of things; a huge number of
times. The things that it does are changing the selection, inserting of text,
deletion of text, inserting table rows, copy and paste, ... All of these
operations are done within a single document(report). The COM Addin is
written in C++ and it uses the WORD object library to manipulate the
document(report).

During the generation of the report the COM Addin crashes when the temporary
scratch file (~WRSxxxx.tmp") reaches the 512 MB limit. The temporary scratch
file is a hard disk cache used by WORD when it runs out of RAM memory. The
_com_error exception that is caught, when the crash occurs is "This command
is not available". The exception occurs when one of the WORD object library
function is called.
The _com_error help context is 37373 and the help file is C:\Program
Files\Microsoft Office\Office10\1033\wdmain10.chm. I looked at the help
context in the help file and it does not seem to give any relevant
information.

When I increase the cachesize of WordXP from 64KB to 1MB, the crash occurs
at a different point, of course, due to a call to Word object library
function.

I believe this is a memory constraint associated with the temporary scratch
file. Somewhere in the WEB, I saw the limits of temporary scratch file and it
ranges from 64KB to 3.5MB. The same report generation works fine with WORD
2003 and maximum size of scratch temporary file reached in this case is 3.5
MB.

While generating the report in WORDXP, when I reduce the number of COPY and
PASTEs the crash occurs a bit later. Initially, I thought it is a problem
with parameters that are passed to Word object library functions. But, that
is not the case since generation goes beyond the crash point when the COPY
and PASTE operations is cut down to a slightly lower number.

My doubts are why does WORDXP temporary scratch file limit exceeds 3.5 MB
(size goes upto 512MB)? Can we increase the size of WORDXP temporary scratch
file above 512 MB)? Can you infer anything from the help context and help
file given above?

Help please!

Thanks.
Ravishankar
 
J

Jean-Guy Marcil

Ravishankar Purushothaman said:
Hello,
I have a WORD XP COM Addin that is used to generate reports. During the
generation of a report, the COM Addin does a lot of things; a huge number of
times. The things that it does are changing the selection, inserting of text,
deletion of text, inserting table rows, copy and paste, ... All of these
operations are done within a single document(report). The COM Addin is
written in C++ and it uses the WORD object library to manipulate the
document(report).

It seems to me that your code may not be efficient in the way it manipulates
the document.

From your description I see you are moving the Seletion and using copy/paste.

Try not to use the Selection object at all.
If you are copying/pasting bits of text, don't! Use the range object instead.
Make sure you have a few "Undo.Clear" in your code, the Undo stack does use
memory.
 
R

Ravishankar Purushothaman

Hi Jean,
I used the ActiveDocument.Range object to copy and then to paste, I used
Selection.Paste but without success. I also put ActiveDocument.Undoclear
while generating the report and it has yielded the same result. I have to
change the selection using the Selection object within the report because the
COM Addin will write to the new location defined by the Selection.

I have a couple of questions.
1. What is the size limit for the word temporary scratch file in WORDXP?

2. Is there anyway of changing the maximum size of word temporary scratch
file in WORDXP?

3. Why does the WORD XP application crashes when the scratch file reaches
512MB size?
Thanks in advance.
Ravi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top