use of org.apache.poi.hssf.record.BackupRecord in project poi by apache.
the class InternalWorkbook method createBackup.
/**
* creates the Backup record with backup set to 0. (loose the data, who cares)
*/
private static BackupRecord createBackup() {
BackupRecord retval = new BackupRecord();
// by default DONT save backups of files...just loose data
retval.setBackup((short) 0);
return retval;
}
use of org.apache.poi.hssf.record.BackupRecord in project poi by apache.
the class HSSFWorkbook method setBackupFlag.
/**
* determine whether the Excel GUI will backup the workbook when saving.
*
* @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);
}
use of org.apache.poi.hssf.record.BackupRecord in project poi by apache.
the class TestWorkbook method testBackupRecord.
/**
* Test the backup field gets set as expected.
* @throws IOException
*/
@Test
public void testBackupRecord() throws IOException {
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());
wb.close();
}
Aggregations