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
477478479480481482483484485486
* @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); }
491492493494495496497498499500
* @return the current setting for backups. */ public boolean getBackupFlag() { BackupRecord backupRecord = workbook.getBackupRecord(); return (backupRecord.getBackup() == 0) ? false : true; }
1173117411751176117711781179118011811182
/** * 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; }
870871872873874875876877878879
884885886887888889890891892893
1174117511761177117811791180118111821183
568569570571572573574575576577578
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()); }
871872873874875876877878879880
885886887888889890891892893894
449450451452453454455456457458459
*/ public void testBackupRecord() { 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()); }