@@ -39,8 +39,8 @@ public CallableValue call() {
3939
4040 private void processAllRows () throws Exception {
4141 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 );
4444
4545 if (row1 == null || row2 == null ) {
4646 if (!(row1 == null && row2 == null )) {
@@ -59,28 +59,30 @@ private void processAllColumns(XSSFRow row1, XSSFRow row2) throws Exception {
5959 boolean isRow1Blank = true , isRow2Blank = true ;
6060
6161 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 );
6466
65- if (Utility . hasNoContent ( cell1 )) {
66- if (Utility . hasContent ( cell2 )) {
67+ if (cell1Value . isEmpty ( )) {
68+ if (! cell2Value . isEmpty ( )) {
6769 isRow2Blank = false ;
6870 crt .setDiffFlag (true );
6971 Utility .processDiffForColumn (cell1 == null ? row1 .createCell (columnIndex ) : cell1 , remarksOnly ,
70- Utility . getCellValue ( cell2 ) , rowRemarks );
72+ cell2Value , rowRemarks );
7173 }
72- } else if (Utility . hasNoContent ( cell2 )) {
73- if (Utility . hasContent ( cell1 )) {
74+ } else if (cell2Value . isEmpty ( )) {
75+ if (! cell1Value . isEmpty ( )) {
7476 isRow1Blank = false ;
7577 crt .setDiffFlag (true );
76- Utility .processDiffForColumn (cell1 , remarksOnly , cell2 == null ? null : Utility . getCellValue ( cell2 ) , rowRemarks );
78+ Utility .processDiffForColumn (cell1 , remarksOnly , cell2Value , rowRemarks );
7779 }
7880 } else {
7981 isRow1Blank = isRow2Blank = false ;
8082
81- if (!Utility . getCellValue ( cell1 ). equals (Utility . getCellValue ( cell2 ) )) {
83+ if (!cell1Value . equals (cell2Value )) {
8284 crt .setDiffFlag (true );
83- Utility .processDiffForColumn (cell1 , remarksOnly , Utility . getCellValue ( cell2 ) , rowRemarks );
85+ Utility .processDiffForColumn (cell1 , remarksOnly , cell2Value , rowRemarks );
8486 }
8587 }
8688 }
@@ -97,24 +99,24 @@ else if(isRow1Blank && !isRow2Blank)
9799
98100 public void processNullRow (XSSFSheet sheet1 , int rowIndex , XSSFRow row2 ) throws Exception {
99101 XSSFRow row1 = sheet1 .getRow (rowIndex );
100- StringBuilder rowRemarks = new StringBuilder ();
102+ // StringBuilder rowRemarks = new StringBuilder();
101103
102104 if (row1 == null ) {
103105 if (row2 .getPhysicalNumberOfCells () != 0 ) {
104106 row1 = sheet1 .createRow (rowIndex );
105107 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+ // }
110112 crt .getDiffContainer ().append (String .format ("\n Added Row[%s] in Sheet[%s]" ,
111113 (row1 .getRowNum () + 1 ), sheet1 .getSheetName ()));
112114 }
113115 } else {
114116 if (row1 .getPhysicalNumberOfCells () != 0 ) {
115117 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);
118120 crt .getDiffContainer ().append (String .format ("\n Removed Row[%s] of Sheet[%s]" ,
119121 (row1 .getRowNum () + 1 ), sheet1 .getSheetName ()));
120122 }
0 commit comments