java.lang.Objectcom.aspose.words.RevisionCollection
public class RevisionCollection
You do not create instances of this class directly. Use the
Property Getters/Setters Summary | ||
---|---|---|
int | getCount() | |
Returns the number of revisions in the collection. | ||
RevisionGroupCollection | getGroups() | |
Collection of revision groups. | ||
Revision | get(int index) | |
Returns a Revision at the specified index. |
Method Summary | ||
---|---|---|
void | acceptAll() | |
Accepts all revisions in this collection. | ||
java.util.Iterator<Revision> | iterator() | |
Returns an enumerator object. | ||
void | rejectAll() | |
Rejects all revisions in this collection. |
Property Getters/Setters Detail |
---|
getCount | |
public int getCount() |
getGroups | |
public RevisionGroupCollection getGroups() |
get | |
public Revision get(int index) |
The index is zero-based.
Negative indexes are allowed and indicate access from the back of the collection. For example -1 means the last item, -2 means the second before last and so on.
If index is greater than or equal to the number of items in the list, this returns a null reference.
If index is negative and its absolute value is greater than the number of items in the list, this returns a null reference.
index
- An index into the collection.Method Detail |
---|
acceptAll | |
public void acceptAll() throws java.lang.Exception |
Example:
Shows how to compare documents.Document docOriginal = new Document(); DocumentBuilder builder = new DocumentBuilder(docOriginal); builder.writeln("This is the original document."); Document docEdited = new Document(); builder = new DocumentBuilder(docEdited); builder.writeln("This is the edited document."); // Comparing documents with revisions will throw an exception. if (docOriginal.getRevisions().getCount() == 0 && docEdited.getRevisions().getCount() == 0) docOriginal.compare(docEdited, "authorName", new Date()); // After the comparison, the original document will gain a new revision // for every element that's different in the edited document. for (Revision r : docOriginal.getRevisions()) { System.out.println("Revision type: {r.RevisionType}, on a node of type \"{r.ParentNode.NodeType}\""); System.out.println("\tChanged text: \"{r.ParentNode.GetText()}\""); } // Accepting these revisions will transform the original document into the edited document. docOriginal.getRevisions().acceptAll(); Assert.assertEquals(docOriginal.getText(), docEdited.getText());
iterator | |
public java.util.Iterator<Revision> iterator() |
rejectAll | |
public void rejectAll() throws java.lang.Exception |