mirror of https://github.com/apache/poi.git
Bug 61863: Update JavaDoc to describe relation to workbook-level flag
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1875804 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
da2afc19e2
commit
e88fac30b8
|
@ -398,6 +398,11 @@ public interface Sheet extends Iterable<Row> {
|
||||||
/**
|
/**
|
||||||
* Whether Excel will be asked to recalculate all formulas in this sheet when the
|
* Whether Excel will be asked to recalculate all formulas in this sheet when the
|
||||||
* workbook is opened.
|
* workbook is opened.
|
||||||
|
*
|
||||||
|
* Note: This just returns if the sheet has the recalculate flag set and
|
||||||
|
* will still return false even if recalculation is enabled on workbook-level.
|
||||||
|
*
|
||||||
|
* @return true if the Sheet has the recalculate-flag set.
|
||||||
*/
|
*/
|
||||||
boolean getForceFormulaRecalculation();
|
boolean getForceFormulaRecalculation();
|
||||||
|
|
||||||
|
|
|
@ -2098,8 +2098,13 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether Excel will be asked to recalculate all formulas when the
|
* Whether Excel will be asked to recalculate all formulas of this sheet
|
||||||
* workbook is opened.
|
* when the workbook is opened.
|
||||||
|
*
|
||||||
|
* Note: This just returns if the sheet has the recalculate flag set and
|
||||||
|
* will still return false even if recalculation is enabled on workbook-level.
|
||||||
|
*
|
||||||
|
* @return true if the Sheet has the recalculate-flag set.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean getForceFormulaRecalculation() {
|
public boolean getForceFormulaRecalculation() {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertSame;
|
import static org.junit.Assert.assertSame;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
@ -36,6 +37,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.apache.poi.EncryptedDocumentException;
|
||||||
import org.apache.poi.hssf.HSSFTestDataSamples;
|
import org.apache.poi.hssf.HSSFTestDataSamples;
|
||||||
import org.apache.poi.ooxml.POIXMLException;
|
import org.apache.poi.ooxml.POIXMLException;
|
||||||
import org.apache.poi.poifs.crypt.CryptoFunctions;
|
import org.apache.poi.poifs.crypt.CryptoFunctions;
|
||||||
|
@ -55,6 +57,7 @@ import org.apache.poi.ss.usermodel.IndexedColors;
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
import org.apache.poi.ss.util.*;
|
import org.apache.poi.ss.util.*;
|
||||||
import org.apache.poi.util.LocaleUtil;
|
import org.apache.poi.util.LocaleUtil;
|
||||||
import org.apache.poi.xssf.XSSFITestDataProvider;
|
import org.apache.poi.xssf.XSSFITestDataProvider;
|
||||||
|
@ -2002,4 +2005,40 @@ public final class TestXSSFSheet extends BaseTestXSheet {
|
||||||
assertNotNull(hfProp);
|
assertNotNull(hfProp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSheetForceFormulaRecalculationDefaultValues() throws IOException {
|
||||||
|
try (Workbook wb = _testDataProvider.openSampleWorkbook("sample.xlsx")){
|
||||||
|
for (Sheet s : wb) {
|
||||||
|
assertEquals(wb.getForceFormulaRecalculation(),s.getForceFormulaRecalculation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWorkbookSetForceFormulaRecalculation() throws IOException {
|
||||||
|
try (Workbook wb = _testDataProvider.openSampleWorkbook("sample.xlsx")){
|
||||||
|
wb.setForceFormulaRecalculation(true);
|
||||||
|
assertTrue(wb.getForceFormulaRecalculation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNotCascadeWorkbookSetForceFormulaRecalculation() throws IOException {
|
||||||
|
try (Workbook wb = _testDataProvider.openSampleWorkbook("sample.xlsx")) {
|
||||||
|
// set all sheets to force recalculation
|
||||||
|
for (Sheet s : wb) {
|
||||||
|
s.setForceFormulaRecalculation(true);
|
||||||
|
assertTrue(s.getForceFormulaRecalculation());
|
||||||
|
}
|
||||||
|
|
||||||
|
// disable on workbook-level
|
||||||
|
wb.setForceFormulaRecalculation(false);
|
||||||
|
|
||||||
|
// on sheet-level, the flag is still set
|
||||||
|
for (Sheet s : wb) {
|
||||||
|
assertTrue("Sheet-level flag is still set to true", s.getForceFormulaRecalculation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue