Description: Boolean specifying whether the GUI should store a backup of the file.
REFERENCE: PG 287 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)
@author Andrew C. Oliver (acoliver at apache dot org) @version 2.0-pre
896897898899900901902903904905
* @param backupValue true to indicate a backup will be performed. */ public void setBackupFlag(boolean backupValue) { BackupRecord backupRecord = workbook.getBackupRecord(); backupRecord.setBackup(backupValue ? (short) 1 : (short) 0); }
910911912913914915916917918919
* @return the current setting for backups. */ public boolean getBackupFlag() { BackupRecord backupRecord = workbook.getBackupRecord(); return (backupRecord.getBackup() == 0) ? false : true; }
1201120212031204120512061207120812091210
/** * creates the Backup record with backup set to 0. (loose the data, who cares) */ private static BackupRecord createBackup() { BackupRecord retval = new BackupRecord(); retval.setBackup(( short ) 0); // by default DONT save backups of files...just loose data return retval; }
1241124212431244124512461247124812491250
482483484485486487488489490491492
throws Exception { HSSFWorkbook wb = new HSSFWorkbook(); wb.createSheet(); Workbook workbook = wb.getWorkbook(); BackupRecord record = workbook.getBackupRecord(); assertEquals(0, record.getBackup()); wb.setBackupFlag(true); assertEquals(1, record.getBackup()); }
860861862863864865866867868869
874875876877878879880881882883
568569570571572573574575576577578
449450451452453454455456457458459460461462463464
*/ public void testBackupRecord() { HSSFWorkbook wb = new HSSFWorkbook(); wb.createSheet(); InternalWorkbook workbook = wb.getWorkbook(); BackupRecord record = workbook.getBackupRecord(); assertEquals(0, record.getBackup()); assertFalse(wb.getBackupFlag()); wb.setBackupFlag(true); assertEquals(1, record.getBackup()); assertTrue(wb.getBackupFlag()); wb.setBackupFlag(false); assertEquals(0, record.getBackup()); assertFalse(wb.getBackupFlag()); }
641642643644645646647648649650651