Start Tracking of Changes Made to Word DOCX Document | Accept or Reject All Changes using Java | HTML Text

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)

@hrom405,

After an initial test with the licensed latest (20.8) version of Aspose.Words for Java, we were unable to reproduce this issue on our end. Please see this Java console output that was produced on our end by using the code you shared earlier:

So, we suggest you please upgrade to the latest version and see how it goes on your end?

I Have 18.8 Paid license and this Issue is occur in that version, I checked For 20.8 Is Working Fine but Not for 18.8 and below Aspose Word versions, So can you check for Aspose Word 18.8 and please help me with some Patch for these Fix.

@hrom405,

I am afraid, there is no workaround available that you can use with 18.8 version. Please note that we do not provide support for older released versions of Aspose.Words. We also do not provide any fixes or patches for old versions of Aspose APIs. All fixes and new features are always added into new versions of our APIs. So, the only solution would be to renew your subscription and upgrade to the latest version of Aspose.Words. You can also request a 30-day Temporary License to verify the correctness of Aspose.Words 20.8 on your end. Please refer to How to get a Temporary License?.