// Convert the cell
RangeHolder ranges = RangeConvertor.convertExcelToCells(wb);
HashMap<String, Object> globals = new HashMap<String, Object>();
// Create a new Excel Logging object
SpreadSheetLogger excelLogger = new SpreadSheetLogger();
// Log the cell contents
log.debug("============ Excel Cell Contents In =========");
for (Range r : ranges) {
log.debug(r);
}
// Set Paramaters
RuleSource ruleSource = new RuleSource();
ruleSource.setDslFileLocation(DSL_FILE);
ruleSource.setRulesLocation(RULES_FILES);
ruleSource.setFacts(ranges.getAllRangesAndCells());
ruleSource.setGlobals(globals);
// Load and fire our rules files against the data
new RuleRunner(new FileRuleLoader()).runStatelessRules(ruleSource,excelLogger);
// Log the cell contents
log.debug("============ Excel Cell Contents Out =========");
for (Range r : ranges) {
log.debug(r);
}
// update the excel spreadsheet with the result of our rules
RangeConvertor.convertCellsToExcel(wb, ranges);
// update the excel spreadsheet with our log file
excelLogger.flush(wb, EXCEL_LOG_WORKSHEET_NAME);
// Write out modified Excel sheet
SpreadSheetOutputter.outputToFile(wb, EXCEL_OUTPUT_FILE);
// Close our input work book