search/mag_sel search/close
Aspose::Words::RevisionGroupCollection Class Referencefinal

A collection of RevisionGroup objects that represent revision groups in the document.

You do not create instances of this class directly. Use the Groups property to get revision groups present in a document.

Examples

Shows how to print info about a group of revisions in a document.

auto doc = MakeObject<Document>(MyDir + u"Revisions.docx");
ASSERT_EQ(7, doc->get_Revisions()->get_Groups()->get_Count());
for (const auto& group : doc->get_Revisions()->get_Groups())
{
std::cout << String::Format(u"Revision author: {0}; Revision type: {1} \n\tRevision text: {2}", group->get_Author(), group->get_RevisionType(),
group->get_Text())
<< std::endl;
}

Shows how to get a group of revisions in a document.

auto doc = MakeObject<Document>(MyDir + u"Revisions.docx");
SharedPtr<RevisionGroup> revisionGroup = doc->get_Revisions()->get_Groups()->idx_get(0);

#include <Aspose.Words.Cpp/RevisionGroupCollection.h>

+ Inheritance diagram for Aspose::Words::RevisionGroupCollection:

Public Types

using const_iterator = typename const_iterator
 
using iterator = typename iterator
 
using iterator_holder_type = List< SharedPtr< RevisionGroup > >
 

Public Member Functions

const_iterator begin () const noexcept
 
iterator begin () noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator cend () const noexcept
 
const_iterator end () const noexcept
 
iterator end () noexcept
 
int32_t get_Count ()
 Returns the number of revision groups in the collection. More...
 
SharedPtr< IEnumerator< SharedPtr< RevisionGroup > > > GetEnumerator () override
 Returns an enumerator object. More...
 
virtual const TypeInfoGetType () const override
 
SharedPtr< RevisionGroupidx_get (int32_t index)
 Returns a revision group at the specified index. More...
 
virtual bool Is (const TypeInfo &target) const override
 

Static Public Member Functions

static const TypeInfoType ()
 

Member Typedef Documentation

◆ const_iterator

◆ iterator

◆ iterator_holder_type

Member Function Documentation

◆ begin() [1/2]

const_iterator Aspose::Words::RevisionGroupCollection::begin ( ) const
noexcept

◆ begin() [2/2]

iterator Aspose::Words::RevisionGroupCollection::begin ( )
noexcept

◆ cbegin()

const_iterator Aspose::Words::RevisionGroupCollection::cbegin ( ) const
noexcept

◆ cend()

const_iterator Aspose::Words::RevisionGroupCollection::cend ( ) const
noexcept

◆ end() [1/2]

const_iterator Aspose::Words::RevisionGroupCollection::end ( ) const
noexcept

◆ end() [2/2]

iterator Aspose::Words::RevisionGroupCollection::end ( )
noexcept

◆ get_Count()

int32_t Aspose::Words::RevisionGroupCollection::get_Count ( )

Returns the number of revision groups in the collection.

Examples

Shows how to print info about a group of revisions in a document.

auto doc = MakeObject<Document>(MyDir + u"Revisions.docx");
ASSERT_EQ(7, doc->get_Revisions()->get_Groups()->get_Count());
for (const auto& group : doc->get_Revisions()->get_Groups())
{
std::cout << String::Format(u"Revision author: {0}; Revision type: {1} \n\tRevision text: {2}", group->get_Author(), group->get_RevisionType(),
group->get_Text())
<< std::endl;
}

◆ GetEnumerator()

System::SharedPtr<System::Collections::Generic::IEnumerator<System::SharedPtr<Aspose::Words::RevisionGroup> > > Aspose::Words::RevisionGroupCollection::GetEnumerator ( )
override

Returns an enumerator object.

Examples

Shows how to work with a document's collection of revisions.

auto doc = MakeObject<Document>(MyDir + u"Revisions.docx");
SharedPtr<RevisionCollection> revisions = doc->get_Revisions();
// This collection itself has a collection of revision groups.
// Each group is a sequence of adjacent revisions.
std::cout << revisions->get_Groups()->get_Count() << " revision groups:" << std::endl;
// Iterate over the collection of groups and print the text that the revision concerns.
{
SharedPtr<System::Collections::Generic::IEnumerator<SharedPtr<RevisionGroup>>> e = revisions->get_Groups()->GetEnumerator();
while (e->MoveNext())
{
std::cout << (String::Format(u"\tGroup type \"{0}\", ", e->get_Current()->get_RevisionType()) +
String::Format(u"author: {0}, contents: [{1}]", e->get_Current()->get_Author(), e->get_Current()->get_Text().Trim()))
<< std::endl;
}
}
// Each Run that a revision affects gets a corresponding Revision object.
// The revisions' collection is considerably larger than the condensed form we printed above,
// depending on how many Runs we have segmented the document into during Microsoft Word editing.
std::cout << "\n" << revisions->get_Count() << " revisions:" << std::endl;
{
SharedPtr<System::Collections::Generic::IEnumerator<SharedPtr<Revision>>> e = revisions->GetEnumerator();
while (e->MoveNext())
{
// A StyleDefinitionChange strictly affects styles and not document nodes. This means the "ParentStyle"
// property will always be in use, while the ParentNode will always be null.
// Since all other changes affect nodes, ParentNode will conversely be in use, and ParentStyle will be null.
if (e->get_Current()->get_RevisionType() == RevisionType::StyleDefinitionChange)
{
std::cout << (String::Format(u"\tRevision type \"{0}\", ", e->get_Current()->get_RevisionType()) +
String::Format(u"author: {0}, style: [{1}]", e->get_Current()->get_Author(), e->get_Current()->get_ParentStyle()->get_Name()))
<< std::endl;
}
else
{
std::cout << (String::Format(u"\tRevision type \"{0}\", ", e->get_Current()->get_RevisionType()) +
String::Format(u"author: {0}, contents: [{1}]", e->get_Current()->get_Author(),
e->get_Current()->get_ParentNode()->GetText().Trim()))
<< std::endl;
}
}
}
// Reject all revisions via the collection, reverting the document to its original form.
revisions->RejectAll();
ASSERT_EQ(0, revisions->get_Count());

◆ GetType()

virtual const System::TypeInfo& Aspose::Words::RevisionGroupCollection::GetType ( ) const
overridevirtual

Reimplemented from System::Object.

◆ idx_get()

System::SharedPtr<Aspose::Words::RevisionGroup> Aspose::Words::RevisionGroupCollection::idx_get ( int32_t  index)

Returns a revision group at the specified index.

Examples

Shows how to get a group of revisions in a document.

auto doc = MakeObject<Document>(MyDir + u"Revisions.docx");
SharedPtr<RevisionGroup> revisionGroup = doc->get_Revisions()->get_Groups()->idx_get(0);

◆ Is()

virtual bool Aspose::Words::RevisionGroupCollection::Is ( const System::TypeInfo target) const
overridevirtual

Reimplemented from System::Object.

◆ Type()

static const System::TypeInfo& Aspose::Words::RevisionGroupCollection::Type ( )
static