Iterator it1 = row1.cellIterator();
Iterator it2 = row2.cellIterator();
while (it1.hasNext() && it2.hasNext())
{
HSSFCell cell1 = (HSSFCell) it1.next();
HSSFCell cell2 = (HSSFCell) it2.next();
if (cell1 == null || cell2 == null)
{
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different data.. File 1 Cell has " + cell1 + "Whereas File2 has " + cell2 + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
outputStream.write(dataToWrite.getBytes());
return false;
}
HSSFCellStyle cell1Style = cell1.getCellStyle();
HSSFCellStyle cell2Style = cell2.getCellStyle();
if (cell1Style == null || cell2Style == null)
{
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a no cell style.. File 1 Cell has " + cell1 + "Whereas File2 has " + cell2 + "\n";
outputStream.write(dataToWrite.getBytes());
return false;
}
else
{
short cell1BorderBottom = cell1Style.getBorderBottom();
short cell1Alignment = cell1Style.getAlignment();
short cell1BorderLeft = cell1Style.getBorderLeft();
short cell1BorderRight = cell1Style.getBorderRight();
short cell1BorderTop = cell1Style.getBorderTop();
short cell1BorderColor = cell1Style.getBottomBorderColor();
short cell1DataFormat = cell1Style.getDataFormat();
short cell1BackgroundColor = cell1Style.getFillBackgroundColor();
short cell1FillForegroundColor = cell1Style.getFillForegroundColor();
short cell1FillPattern = cell1Style.getFillPattern();
short cell1LeftBorderColor = cell1Style.getLeftBorderColor();
short cell1RightBorderColor = cell1Style.getRightBorderColor();
short cell1VerticalAlignment = cell1Style.getVerticalAlignment();
boolean cell1WrapText = cell1Style.getWrapText();
short cell1Rotation = cell1Style.getRotation();
short cell2BorderBottom = cell2Style.getBorderBottom();
short cell2Alignment = cell2Style.getAlignment();
short cell2BorderLeft = cell2Style.getBorderLeft();
short cell2BorderRight = cell2Style.getBorderRight();
short cell2BorderTop = cell2Style.getBorderTop();
short cell2BorderColor = cell2Style.getBottomBorderColor();
short cell2DataFormat = cell2Style.getDataFormat();
short cell2BackgroundColor = cell2Style.getFillBackgroundColor();
short cell2FillForegroundColor = cell2Style.getFillForegroundColor();
short cell2FillPattern = cell2Style.getFillPattern();
short cell2LeftBorderColor = cell2Style.getLeftBorderColor();
short cell2RightBorderColor = cell2Style.getRightBorderColor();
short cell2VerticalAlignment = cell2Style.getVerticalAlignment();
boolean cell2WrapText = cell2Style.getWrapText();
short cell2Rotation = cell2Style.getRotation();
if (cell1BorderBottom != cell2BorderBottom)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Bottom Border" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
if (cell1Alignment != cell2Alignment)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Cell Alignment" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
if (cell1BorderLeft != cell2BorderLeft)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Left Border" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
if (cell1BorderRight != cell2BorderRight)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Right Border" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
if (cell1BorderTop != cell2BorderTop)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Top Border" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
if (cell1BorderColor != cell2BorderColor)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Border Color" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
if (cell1DataFormat != cell2DataFormat)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Data Format" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
if (cell1BackgroundColor != cell2BackgroundColor)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Background Color" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
if (cell1FillForegroundColor != cell2FillForegroundColor)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Foreground Color" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
if (cell1FillPattern != cell2FillPattern)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Fill Pattern" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
if (cell1LeftBorderColor != cell2LeftBorderColor)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Left Border Color" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
if (cell2RightBorderColor != cell1RightBorderColor)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Right Border Color" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
if (cell1VerticalAlignment != cell2VerticalAlignment)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Vertical Alignment" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
if (cell1Rotation != cell2Rotation)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Cell Rotation" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
if (cell1WrapText != cell2WrapText)
{
equal = false;
String dataToWrite = "Sheet # " + sheetNumber + "Row # " + j + "Cell # " + cell1.getCellNum() + "has a different Wrap Text" + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
outputStream.write(dataToWrite.getBytes());
}
}
String cell1Value = cell1.toString();
String cell2Value = cell2.toString();
if (cell1Value != null && cell2Value != null)
{
if (cell1Value.equals(cell2Value) == false)
{
equal = false;