Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

COleDocument double size

Posted on 1998-08-22
7
Medium Priority
?
360 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
Industry Leaders: 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 800 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

610 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