Solved

COleDocument double size

Posted on 1998-08-22
7
357 Views
Last Modified: 2013-11-20
I have a COleDocument, default from AppWizard, with a call to EnableCompoundFile() on the constructor.
When I save an existing document, the size is doubled. For example, a new name document save to 83k, and if I save it again, it got 163k and stay to this size on future save.
Does someone know why, and a workaround to always save like the first time (why the littlest size) ?
I cannot change the document format (not calling EnableCompoundFile() to get a flat document for example), because I absolutely need a compatibility with older documents.
I’ve try to force m_strPathName to empty before OnSaveDocument, or delete the file, but the document already open in my application is locked and cannot be created or deleted.

Thank you for your help.
0
Comment
Question by:dmunoz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 8

Expert Comment

by:Answers2000
ID: 1321149
I think this is a consequence of OLE compound files rather than anything you're doing.

I know some M$ apps generate hug files.  PC World had a utility (command line) a while a go to recover space.
0
 

Author Comment

by:dmunoz
ID: 1321150
Yes, I think too that it's an OLE consequence.
But I cannot switch to flat (not OLE) because of my need to
keep compatibility with old files.

0
 
LVL 1

Expert Comment

by:Bridge
ID: 1321151
COleDocument is the base for documents that support visual editing. This requires extra functionality, primarily the presentation data associated with the OLE document. Seeing as this is a data is in the form of a metafile it will take up plenty of space.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:dmunoz
ID: 1321152
Ok Bridge, but it dont explain with the first save is smaller than the others. What I need is an explanation why this size is double, an possibly a way to work araound, and save next documents in the form of the first one.

0
 

Author Comment

by:dmunoz
ID: 1321153
Ok, this seem to be a hard one...
so, I double the price ;-))

Please help...

0
 
LVL 1

Accepted Solution

by:
Bridge earned 200 total points
ID: 1321154
Right lets try again.
The IStorage object within the OLE Document m_lpRootStg saves itself using the commit command within the OLEDOC1.cpp file. The parameter it uses is STGC_ONLYIFCURRENT. From the help this seems to be a 'safe' commit which preservers data. To avoid this the STGC_OVERWRITE should be used instead.
0
 

Author Comment

by:dmunoz
ID: 1321155
Thank you Bridge.
Your answer perfectly fit my need.

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question