Package org.apache.poi.examples.ss
Class ExcelComparator
- java.lang.Object
-
- org.apache.poi.examples.ss.ExcelComparator
-
public class ExcelComparator extends Object
Utility to compare Excel File Contents cell by cell for all sheets.This utility will be used to compare Excel File Contents cell by cell for all sheets programmatically.
Below are the list of Attribute comparison supported in this version.
- Cell Alignment
- Cell Border Attributes
- Cell Data
- Cell Data-Type
- Cell Fill Color
- Cell Fill pattern
- Cell Font Attributes
- Cell Font Family
- Cell Font Size
- Cell Protection
- Name of the sheets
- Number of Columns
- Number of Rows
- Number of Sheet
(Some of the above attribute comparison only work for *.xlsx format currently. In future it can be enhanced.)
Usage:
Workbook wb1 = WorkbookFactory.create(new File("workBook1.xls")); Workbook wb2 = WorkbookFactory.create(new File("workBook2.xls")); List<String> listOfDifferences = ExcelComparator.compare(wb1, wb2); for (String differences : listOfDifferences) System.out.println(differences); System.out.println("DifferenceFound = "+ excelFileDifference.isDifferenceFound);
-
-
Constructor Summary
Constructors Constructor Description ExcelComparator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<String>compare(Workbook wb1, Workbook wb2)Utility to compare Excel File Contents cell by cell for all sheets.static voidmain(String[] args)
-