@@ -55,7 +55,7 @@ private void processAllRows() throws Exception {
5555 }
5656
5757 private void processAllColumns (XSSFRow row1 , XSSFRow row2 ) throws Exception {
58- StringBuilder sb = new StringBuilder ();
58+ StringBuilder rowRemarks = new StringBuilder ();
5959 boolean isRow1Blank = true , isRow2Blank = true ;
6060
6161 for (int columnIndex = 0 ; columnIndex <= row1 .getLastCellNum (); columnIndex ++) {
@@ -67,55 +67,55 @@ private void processAllColumns(XSSFRow row1, XSSFRow row2) throws Exception {
6767 isRow2Blank = false ;
6868 crt .setDiffFlag (true );
6969 Utility .processDiffForColumn (cell1 == null ? row1 .createCell (columnIndex ) : cell1 , remarksOnly ,
70- Utility .getCellValue (cell2 ), sb );
70+ Utility .getCellValue (cell2 ), rowRemarks );
7171 }
7272 } else if (Utility .hasNoContent (cell2 )) {
7373 if (Utility .hasContent (cell1 )) {
7474 isRow1Blank = false ;
7575 crt .setDiffFlag (true );
76- Utility .processDiffForColumn (cell1 , remarksOnly , cell2 == null ? null : Utility .getCellValue (cell2 ), sb );
76+ Utility .processDiffForColumn (cell1 , remarksOnly , cell2 == null ? null : Utility .getCellValue (cell2 ), rowRemarks );
7777 }
7878 } else {
7979 isRow1Blank = isRow2Blank = false ;
8080
8181 if (!Utility .getCellValue (cell1 ).equals (Utility .getCellValue (cell2 ))) {
8282 crt .setDiffFlag (true );
83- Utility .processDiffForColumn (cell1 , remarksOnly , Utility .getCellValue (cell2 ), sb );
83+ Utility .processDiffForColumn (cell1 , remarksOnly , Utility .getCellValue (cell2 ), rowRemarks );
8484 }
8585 }
8686 }
8787
8888 if (!isRow1Blank && isRow2Blank )
89- crt .getDiffContainer ().append (String .format ("Removed Row[%s] in sheet [%s]\n " ,
89+ crt .getDiffContainer ().append (String .format ("\n Removed Row[%s] of Sheet [%s]" ,
9090 (row1 .getRowNum () + 1 ), sheet1 .getSheetName ()));
9191 else if (isRow1Blank && !isRow2Blank )
92- crt .getDiffContainer ().append (String .format ("Added Row[%s] in sheet [%s]\n " ,
92+ crt .getDiffContainer ().append (String .format ("\n Added Row[%s] in Sheet [%s]" ,
9393 (row1 .getRowNum () + 1 ), sheet1 .getSheetName ()));
9494 else
95- crt .getDiffContainer ().append (sb );
95+ crt .getDiffContainer ().append (rowRemarks );
9696 }
9797
9898 public void processNullRow (XSSFSheet sheet1 , int rowIndex , XSSFRow row2 ) throws Exception {
9999 XSSFRow row1 = sheet1 .getRow (rowIndex );
100- StringBuilder sb = new StringBuilder ();
100+ StringBuilder rowRemarks = new StringBuilder ();
101101
102102 if (row1 == null ) {
103103 if (row2 .getPhysicalNumberOfCells () != 0 ) {
104104 row1 = sheet1 .createRow (rowIndex );
105105 crt .setDiffFlag (true );
106106 for (int columnIndex = 0 ; columnIndex <= row2 .getLastCellNum (); columnIndex ++) {
107107 Utility .processDiffForColumn (row1 .createCell (0 ), remarksOnly ,
108- Utility .getCellValue (row2 .getCell (columnIndex )), sb );
108+ Utility .getCellValue (row2 .getCell (columnIndex )), rowRemarks );
109109 }
110- crt .getDiffContainer ().append (String .format ("Added Row[%s] in sheet [%s]\n " ,
110+ crt .getDiffContainer ().append (String .format ("\n Added Row[%s] in Sheet [%s]" ,
111111 (row1 .getRowNum () + 1 ), sheet1 .getSheetName ()));
112112 }
113113 } else {
114114 if (row1 .getPhysicalNumberOfCells () != 0 ) {
115115 crt .setDiffFlag (true );
116116 XSSFCell cell1 = row1 .getCell (0 );
117- Utility .processDiffForColumn (cell1 == null ? row1 .createCell (0 ) : cell1 , remarksOnly , "Null row" , sb );
118- crt .getDiffContainer ().append (String .format ("Removed Row[%s] in sheet [%s]\n " ,
117+ Utility .processDiffForColumn (cell1 == null ? row1 .createCell (0 ) : cell1 , remarksOnly , "Null row" , rowRemarks );
118+ crt .getDiffContainer ().append (String .format ("\n Removed Row[%s] of Sheet [%s]" ,
119119 (row1 .getRowNum () + 1 ), sheet1 .getSheetName ()));
120120 }
121121 }
0 commit comments