Hi,
I start TrackChanges in MsWord And added 2 Text, but after in java when i Accept all Revision, Only First Text Revision Was accepted other was Rejected.
My JAVA Code is
public static void main(String[] args) throws Exception {
com.aspose.words.License wordLicense = new com.aspose.words.License();
wordLicense.setLicense("/home/hariom/Downloads/cher/aspose-licence");
Document document = new Document("/home/hariom/Downloads/Work Order Clean (2).docx");
System.out.println("BEFOR ACCEPT ALL REVISION \n");
for (Object st : document.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG, true)) {
StructuredDocumentTag std = (StructuredDocumentTag) st;
if (std.getSdtType() == SdtType.RICH_TEXT && (std.getTag().equals("BASIC__1001__13424__138__138") || std.getTag().equals("BASIC__1001__13324__138__138"))) {
System.out.println("Tag ID = " + std.getTag());
System.out.println("title = " + std.getTitle() + "\n");
System.out.println("TEXT = " + std.getText() + "\n");
HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.HTML);
opts.setPrettyFormat(true);
System.out.println("HTML TEXT = " + std.toString(opts) + "\n");
}
}
System.out.println("AFTER ACCEPT ALL REVISION \n");
if (document.hasRevisions()) {
document.acceptAllRevisions();
document.stopTrackRevisions();
}
for (Object st : document.getChildNodes(NodeType.STRUCTURED_DOCUMENT_TAG, true)) {
StructuredDocumentTag std = (StructuredDocumentTag) st;
if (std.getSdtType() == SdtType.RICH_TEXT && (std.getTag().equals("BASIC__1001__13424__138__138") || std.getTag().equals("BASIC__1001__13324__138__138"))) {
System.out.println("Tag ID = " + std.getTag());
System.out.println("title = " + std.getTitle() + "\n");
System.out.println("TEXT = " + std.getText() + "\n");
HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.HTML);
opts.setPrettyFormat(true);
System.out.println("HTML TEXT = " + std.toString(opts) + "\n");
}
}
}
and outPut On the Console
BEFOR ACCEPT ALL REVISION
Tag ID = BASIC__1001__13424__138__138
title = Change Management
TEXT = The Supplier reserves the right to make changes to the services which do not materially adversely affect the nature or quality of the Services. The Customer acknowledges and accepts that the Supplier may make the said changes, if necessary, without the need for notification, provided they do not materially adversely affect the Services. The Supplier may also modify or vary aspects of the Services, save that where the said change has a materially adverse impact on the Services.
HTML TEXT =
The Supplier reserves the right to make changes to the services which do not materially adversely affect the nature or quality of the Services. The Customer acknowledges and accepts that the Supplier may make the said changes, if necessary, without the need for notification, provided they do not materially adversely affect the Services. The Supplier may also modify or vary aspects of the Services, save that where the said change has a materially adverse impact on the Services.
Tag ID = BASIC__1001__13324__138__138
title = Dispute Resolution
TEXT = In case any dispute or difference shall arise between the Customer and the Supplier as to the construction, meaning, and effect of anything herein contained, such dispute or difference shall be referred to 2 (two) arbitrators in London, England, to be appointed by the Customer and the Supplier respectively and in case of their disagreement to an umpire to be appointed by the 2 (two) arbitrators as chosen, and this agreement shall be deemed to be a submission to arbitration within the meaning of the Arbitration Act 1950 or any statutory modification or re-enactment thereof for the time being in force. The decisions of the 2 (two) arbitrators or the umpire, as the case may be, shall be final and binding upon both parties.
HTML TEXT =
In case any dispute or difference shall arise between the Customer and the Supplier as to the construction, meaning, and effect of anything herein contained, such dispute or difference shall be referred to 2 (two) arbitrators in London, England, to be appointed by the Customer and the Supplier respectively and in case of their disagreement to an umpire to be appointed by the 2 (two) arbitrators as chosen, and this agreement shall be deemed to be a submission to arbitration within the meaning of the Arbitration Act 1950 or any statutory modification or re-enactment thereof for the time being in force. The decisions of the 2 (two) arbitrators or the umpire, as the case may be, shall be final and binding upon both parties.
AFTER ACCEPT ALL REVISION
Tag ID = BASIC__1001__13424__138__138
title = Change Management
TEXT = The Supplier reserves the right to make changes to the services which do not materially adversely affect the nature or quality of the Services. The Customer acknowledges and accepts that the Supplier may make the said changes, if necessary, without the need for notification, provided they do not materially adversely affect the Services. The Supplier may also modify or vary aspects of the Services, save that where the said change has a materially adverse impact on the Services.
HTML TEXT =
The Supplier reserves the right to make changes to the services which do not materially adversely affect the nature or quality of the Services. The Customer acknowledges and accepts that the Supplier may make the said changes, if necessary, without the need for notification, provided they do not materially adversely affect the Services. The Supplier may also modify or vary aspects of the Services, save that where the said change has a materially adverse impact on the Services.
Tag ID = BASIC__1001__13324__138__138
title = Dispute Resolution
TEXT =
HTML TEXT =
As you can See For Title “Dispute Resolution” Text and Html text was Removed, I don’t Know the Reson but when I Accept All revision in MS WORD Print in Html text in java All Working Fine.
word Document Used For this java Code In Below Zip File.Work Order Clean (2).docx.zip (27.2 KB)