CollapseDrafts
Document ShellThe CollapseDrafts method removes the specified range of empty drafts from this document.
ODDocument CollapseDrafts (in ODDraft from, in ODDraft to);
from- A reference to the first (most recent) draft in the range.
to- A reference to the last (oldest) draft in the range.
- return value
- A reference to this document with the specified drafts removed.
DISCUSSION
If thetoparameter iskODNULL, it is set to the draft immediately previous to (below) thefromdraft. When successful, this method removes all the drafts between thefromdraft (inclusive) and thetodraft (exclusive), and returns a reference to the amended document object. This method maintains the appropriate draft topology for this document. After successful execution, thefromdraft is no longer a valid draft object.For this method to be successful, the following conditions must all be met:
Before calling this method, the document shell or container application can call the
- The
fromdraft itself must have a reference count of 1, meaning that only the caller has a reference to that draft object.- The
fromdraft must not be this document's base draft and must be more recent than (above) thetodraft in this document's draft history.- All the drafts targeted for removal must be empty. A draft is empty if it contains no changes from its previous draft.
- There must be no outstanding drafts between the
fromdraft (exclusive) and thetodraft (exclusive). An outstanding draft has a reference count greater than 0, meaning that it is being used by some object.
SaveToAPrevDraftmethod to consolidate the changes in a range of drafts.EXCEPTIONS
kODErrCannotCollapseDrafts- The
fromdraft is not a more recent draft than thetodraft.kODErrNonEmptyDraft- There are non-empty draft(s) between the
fromdraft (inclusive) and thetodraft (exclusive).kODErrOutstandingDraft- There are outstanding drafts between the
fromdraft (exclusive) and thetodraft (exclusive) or thefromdraft has a reference count greater than 1.SEE ALSO
TheODDocument::SaveToAPrevDraftmethod (page 144).