public void testErrorFormula() {
Book book = new ExcelImporter().imports(getClass().getResource("/div0.xls"));
String[] names = book.getNameRangeNames();
System.out.println("names="+Objects.toString(names));
Sheet sheet = (Sheet) book.getSheets().get(0);
//test single column range
for (int j = 1; j < 8; ++j) { //A1 ~ A7
Cell cell = sheet.getCell(j-1,0);
assertEquals(""+j, cell.getText());
}
{
Cell cell = sheet.getCell(7,0); //A8
assertEquals("#VALUE!", cell.getText());
}
//test single row range
for (int j = 1; j < 7; ++j) { //A9 ~ F9
Cell cell = sheet.getCell(8, j-1);
assertEquals(""+(j*10), cell.getText());
}
{
Cell cell = sheet.getCell(8,6); //G9
assertEquals("#VALUE!", cell.getText());
}
//test multiple row and column range
{
Cell cell = sheet.getCell(11,0); //A12
assertEquals("#VALUE!", cell.getText());
}
//test single cell range
{
Cell cell = sheet.getCell(12,0); //A13
assertEquals("100", cell.getText());
}
}