Skip to content

Commit bf7c2a8

Browse files
Fix code examples
1 parent e48b787 commit bf7c2a8

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

nodejs-java/advanced-usage/accept-or-reject-revisions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const revisionOptions = new groupdocs.ApplyRevisionOptions();
5555
revisionOptions.setChanges(revisionList);
5656

5757
// Apply the revision changes and save the result to a new file
58-
revisionHandler.applyRevisionChanges('sample-files/result.docx', revisionOptions);
58+
revisionHandler.applyRevisionChanges('result.docx', revisionOptions);
5959

6060
// Exit the process
6161
process.exit(0);
@@ -129,7 +129,7 @@ const InputStream = java.import('java.io.FileInputStream');
129129

130130
// Define file paths for input revision document and output result document
131131
const revisionFile = 'sample-files/revision.docx';
132-
const resultFile = 'sample-files/result.docx';
132+
const resultFile = 'result.docx';
133133

134134
// Create a file input stream from the revision document
135135
const revisionStream = new InputStream(revisionFile);

nodejs-java/advanced-usage/comparison/accept-or-reject-detected-changes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ comparer.add(targetInputStream);
103103
comparer.compare('result.docx');
104104

105105
// Retrieve list of detected changes
106-
const changes = comparer.getChanges();
106+
let changes = comparer.getChanges();
107107

108108
// Reject the first detected change
109109
changes[0].setComparisonAction(groupdocs.ComparisonAction.REJECT);

nodejs-java/advanced-usage/comparison/get-changes-coordinates.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ The following code snippet shows how to compare documents and obtain coordinates
2121
const groupdocs = require('@groupdocs/groupdocs.comparison');
2222

2323
// Define file paths for the source, target, and result documents
24-
const sourceFile = "sample-files/source.docx";
25-
const targetFile = "sample-files/target.docx";
26-
const resultFile = "result.docx";
24+
const sourceFile = 'sample-files/source.docx';
25+
const targetFile = 'sample-files/target.docx';
26+
const resultFile = 'result.docx';
2727

2828
// Create a comparer instance for the source document
2929
const comparer = new groupdocs.Comparer(sourceFile);

nodejs-java/advanced-usage/comparison/how-to-merge-source-code-files.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,38 @@ const java = require('java');
3737
const sourcePath = 'sample-files/source.docx';
3838
const targetPath = 'sample-files/target.docx';
3939
const outputPath = 'result.docx';
40+
4041
// Initialize comparer with the source document
4142
const comparer = new groupdocs.Comparer(sourcePath);
43+
4244
// Add the target document to be compared against the source
4345
comparer.add(targetPath);
46+
4447
// Execute the comparison operation
4548
comparer.compare(outputPath);
49+
4650
// Retrieve the list of detected changes
4751
const changes = comparer.getChanges();
52+
4853
// Accept the first 10 changes (or fewer if less than 10 exist)
4954
for (let i = 0; i < 10 && i < changes.length; i++) {
5055
changes[i].setComparisonAction(groupdocs.ComparisonAction.ACCEPT);
5156
}
57+
5258
// Reject the remaining changes
5359
for (let i = 10; i < changes.length; i++) {
5460
changes[i].setComparisonAction(groupdocs.ComparisonAction.REJECT);
5561
}
62+
5663
// Prepare options for applying changes
5764
// Convert JavaScript array to Java array
5865
const changeArray = java.newArray('com.groupdocs.comparison.result.ChangeInfo', changes);
5966
const applyChangeOptions = new groupdocs.ApplyChangeOptions();
6067
applyChangeOptions.setChanges(changeArray);
68+
6169
// Apply the changes to the source document and save the result
6270
comparer.applyChanges(outputPath, applyChangeOptions);
71+
6372
// Terminate the process with a success exit code
6473
process.exit(0);
6574
```

0 commit comments

Comments
 (0)