private void testZSS547_DeleteSheet(Book book) { Ranges.range(book.getSheetAt(0), "A1").getCellValue(); // eval. Sheet1 A1 Ranges.range(book.getSheetAt(0)).deleteSheet(); // delete Sheet1 Ranges.range(book.getSheetAt(2)).deleteSheet(); // delete Sheet4 // eval Sheet3 F1 Assert.assertEquals(new Double(3.0), Ranges.range(book.getSheetAt(1), "F1").getCellValue()); // NOTE, there should not be any exception }
@Test public void testZSS502_NonExistingSheet2007() { Book book = Util.loadBook(this, "book/blank.xlsx"); Sheet sheet = book.getSheetAt(0); Range cell = Ranges.range(sheet, "A1"); cell.setCellEditText("=nonExisted!B1"); assertEquals("=nonExisted!B1", cell.getCellEditText()); assertEquals(ErrorConstants.getText(ErrorConstants.ERROR_REF), cell.getCellFormatText()); }
@Test public void testZSS510() { Book book = Util.loadBook(this, "book/blank.xlsx"); Sheet sheet = book.getSheetAt(0); Range r = Ranges.range(sheet, "A1"); r.setCellEditText("Hello"); CellOperationUtil.applyDataFormat(r, ""); r.getCellFormatText(); // get text shouldn't cause IndexOutBoundaryException assertEquals( "General", r.getCellStyle().getDataFormat()); // should get General instead of empty string }