@@ -39,8 +39,8 @@ public CallableValue call() {
39
39
40
40
private void processAllRows () throws Exception {
41
41
for (int rowIndex = 0 ; rowIndex <= sheet1 .getLastRowNum (); rowIndex ++) {
42
- XSSFRow row1 = ( XSSFRow ) sheet1 .getRow (rowIndex );
43
- XSSFRow row2 = ( XSSFRow ) sheet2 .getRow (rowIndex );
42
+ XSSFRow row1 = sheet1 .getRow (rowIndex );
43
+ XSSFRow row2 = sheet2 .getRow (rowIndex );
44
44
45
45
if (row1 == null || row2 == null ) {
46
46
if (!(row1 == null && row2 == null )) {
@@ -59,28 +59,30 @@ private void processAllColumns(XSSFRow row1, XSSFRow row2) throws Exception {
59
59
boolean isRow1Blank = true , isRow2Blank = true ;
60
60
61
61
for (int columnIndex = 0 ; columnIndex <= row1 .getLastCellNum (); columnIndex ++) {
62
- XSSFCell cell1 = (XSSFCell ) row1 .getCell (columnIndex );
63
- XSSFCell cell2 = (XSSFCell ) row2 .getCell (columnIndex );
62
+ XSSFCell cell1 = row1 .getCell (columnIndex );
63
+ XSSFCell cell2 = row2 .getCell (columnIndex );
64
+ String cell1Value = Utility .getCellValue (cell1 );
65
+ String cell2Value = Utility .getCellValue (cell2 );
64
66
65
- if (Utility . hasNoContent ( cell1 )) {
66
- if (Utility . hasContent ( cell2 )) {
67
+ if (cell1Value . isEmpty ( )) {
68
+ if (! cell2Value . isEmpty ( )) {
67
69
isRow2Blank = false ;
68
70
crt .setDiffFlag (true );
69
71
Utility .processDiffForColumn (cell1 == null ? row1 .createCell (columnIndex ) : cell1 , remarksOnly ,
70
- Utility . getCellValue ( cell2 ) , rowRemarks );
72
+ cell2Value , rowRemarks );
71
73
}
72
- } else if (Utility . hasNoContent ( cell2 )) {
73
- if (Utility . hasContent ( cell1 )) {
74
+ } else if (cell2Value . isEmpty ( )) {
75
+ if (! cell1Value . isEmpty ( )) {
74
76
isRow1Blank = false ;
75
77
crt .setDiffFlag (true );
76
- Utility .processDiffForColumn (cell1 , remarksOnly , cell2 == null ? null : Utility . getCellValue ( cell2 ) , rowRemarks );
78
+ Utility .processDiffForColumn (cell1 , remarksOnly , cell2Value , rowRemarks );
77
79
}
78
80
} else {
79
81
isRow1Blank = isRow2Blank = false ;
80
82
81
- if (!Utility . getCellValue ( cell1 ). equals (Utility . getCellValue ( cell2 ) )) {
83
+ if (!cell1Value . equals (cell2Value )) {
82
84
crt .setDiffFlag (true );
83
- Utility .processDiffForColumn (cell1 , remarksOnly , Utility . getCellValue ( cell2 ) , rowRemarks );
85
+ Utility .processDiffForColumn (cell1 , remarksOnly , cell2Value , rowRemarks );
84
86
}
85
87
}
86
88
}
@@ -97,24 +99,24 @@ else if(isRow1Blank && !isRow2Blank)
97
99
98
100
public void processNullRow (XSSFSheet sheet1 , int rowIndex , XSSFRow row2 ) throws Exception {
99
101
XSSFRow row1 = sheet1 .getRow (rowIndex );
100
- StringBuilder rowRemarks = new StringBuilder ();
102
+ // StringBuilder rowRemarks = new StringBuilder();
101
103
102
104
if (row1 == null ) {
103
105
if (row2 .getPhysicalNumberOfCells () != 0 ) {
104
106
row1 = sheet1 .createRow (rowIndex );
105
107
crt .setDiffFlag (true );
106
- for (int columnIndex = 0 ; columnIndex <= row2 .getLastCellNum (); columnIndex ++) {
107
- Utility .processDiffForColumn (row1 .createCell (0 ), remarksOnly ,
108
- Utility .getCellValue (row2 .getCell (columnIndex )), rowRemarks );
109
- }
108
+ // for (int columnIndex = 0; columnIndex <= row2.getLastCellNum(); columnIndex++) {
109
+ // Utility.processDiffForColumn(row1.createCell(0), remarksOnly,
110
+ // Utility.getCellValue(row2.getCell(columnIndex)), rowRemarks);
111
+ // }
110
112
crt .getDiffContainer ().append (String .format ("\n Added Row[%s] in Sheet[%s]" ,
111
113
(row1 .getRowNum () + 1 ), sheet1 .getSheetName ()));
112
114
}
113
115
} else {
114
116
if (row1 .getPhysicalNumberOfCells () != 0 ) {
115
117
crt .setDiffFlag (true );
116
- XSSFCell cell1 = row1 .getCell (0 );
117
- Utility .processDiffForColumn (cell1 == null ? row1 .createCell (0 ) : cell1 , remarksOnly , "Null row" , rowRemarks );
118
+ // XSSFCell cell1 = row1.getCell(0);
119
+ // Utility.processDiffForColumn(cell1 == null ? row1.createCell(0) : cell1, remarksOnly, "Null row", rowRemarks);
118
120
crt .getDiffContainer ().append (String .format ("\n Removed Row[%s] of Sheet[%s]" ,
119
121
(row1 .getRowNum () + 1 ), sheet1 .getSheetName ()));
120
122
}
0 commit comments