Solved

COleDocument double size

Posted on 1998-08-22
7
349 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
  • 4
  • 2
7 Comments
 
LVL 8

Expert Comment

by:Answers2000
Comment Utility
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
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:dmunoz
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you Bridge.
Your answer perfectly fit my need.

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Creating Labels and Frequency list style reports in SAS code 9 88
WinWaitActive parameters 12 31
maxBlock challenge 30 99
Not needed 13 52
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This video discusses moving either the default database or any database to a new volume.

728 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now