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
Solved

COleDocument double size

Posted on 1998-08-22
7
355 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
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Title # Comments Views Activity
maven archtype selection in eclipse 1 57
Hibernate methods 2 77
Problem to event 3 102
how to split multiple lines delimiter : 8 109
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

792 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