Examples of CTCalcPr


Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr

     * @since 3.8
     */
    @Override
    public void setForceFormulaRecalculation(boolean value){
        CTWorkbook ctWorkbook = getCTWorkbook();
        CTCalcPr calcPr = ctWorkbook.isSetCalcPr() ? ctWorkbook.getCalcPr() : ctWorkbook.addNewCalcPr();
        // when set to 0, will tell Excel that it needs to recalculate all formulas
        // in the workbook the next time the file is opened.
        calcPr.setCalcId(0);

        if(value && calcPr.getCalcMode() == STCalcMode.MANUAL) {
            calcPr.setCalcMode(STCalcMode.AUTO);
        }
    }
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr

     * @since 3.8
     */
    @Override
    public boolean getForceFormulaRecalculation(){
        CTWorkbook ctWorkbook = getCTWorkbook();
        CTCalcPr calcPr = ctWorkbook.getCalcPr();
        return calcPr != null && calcPr.getCalcId() != 0;
    }
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr

        CTWorkbook ctWorkbook = wb.getCTWorkbook();
        assertFalse(ctWorkbook.isSetCalcPr());

        wb.setForceFormulaRecalculation(true); // resets the EngineId flag to zero

        CTCalcPr calcPr = ctWorkbook.getCalcPr();
        assertNotNull(calcPr);
        assertEquals(0, (int) calcPr.getCalcId());

        calcPr.setCalcId(100);
        assertTrue(wb.getForceFormulaRecalculation());

        wb.setForceFormulaRecalculation(true); // resets the EngineId flag to zero
        assertEquals(0, (int) calcPr.getCalcId());
        assertFalse(wb.getForceFormulaRecalculation());
    }
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr

     * this worksheet values when the workbook is opened
     *
     * @see org.apache.poi.ss.usermodel.Workbook#setForceFormulaRecalculation(boolean)
     */
    public void setForceFormulaRecalculation(boolean value) {
        CTCalcPr calcPr = getWorkbook().getCTWorkbook().getCalcPr();

        if(worksheet.isSetSheetCalcPr()) {
          // Change the current setting
          CTSheetCalcPr calc = worksheet.getSheetCalcPr();
          calc.setFullCalcOnLoad(value);
       }
       else if(value) {
          // Add the Calc block and set it
          CTSheetCalcPr calc = worksheet.addNewSheetCalcPr();
          calc.setFullCalcOnLoad(value);
       }
        if(value && calcPr != null && calcPr.getCalcMode() == STCalcMode.MANUAL) {
            calcPr.setCalcMode(STCalcMode.AUTO);
        }

    }
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr

        CTWorkbook ctWorkbook = wb.getCTWorkbook();
        assertFalse(ctWorkbook.isSetCalcPr());

        wb.setForceFormulaRecalculation(true); // resets the EngineId flag to zero

        CTCalcPr calcPr = ctWorkbook.getCalcPr();
        assertNotNull(calcPr);
        assertEquals(0, (int) calcPr.getCalcId());

        calcPr.setCalcId(100);
        assertTrue(wb.getForceFormulaRecalculation());

        wb.setForceFormulaRecalculation(true); // resets the EngineId flag to zero
        assertEquals(0, (int) calcPr.getCalcId());
        assertFalse(wb.getForceFormulaRecalculation());

        // calcMode="manual" is unset when forceFormulaRecalculation=true
        calcPr.setCalcMode(STCalcMode.MANUAL);
        wb.setForceFormulaRecalculation(true);
        assertEquals(STCalcMode.AUTO, calcPr.getCalcMode());

    }
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr

        // Set
        sheet.setForceFormulaRecalculation(true);
        assertEquals(true, sheet.getForceFormulaRecalculation());

        // calcMode="manual" is unset when forceFormulaRecalculation=true
        CTCalcPr calcPr = workbook.getCTWorkbook().addNewCalcPr();
        calcPr.setCalcMode(STCalcMode.MANUAL);
        sheet.setForceFormulaRecalculation(true);
        assertEquals(STCalcMode.AUTO, calcPr.getCalcMode());

        // Check
        sheet.setForceFormulaRecalculation(false);
        assertEquals(false, sheet.getForceFormulaRecalculation());
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr

        // Set
        sheet.setForceFormulaRecalculation(true);
        assertEquals(true, sheet.getForceFormulaRecalculation());

        // calcMode="manual" is unset when forceFormulaRecalculation=true
        CTCalcPr calcPr = workbook.getCTWorkbook().addNewCalcPr();
        calcPr.setCalcMode(STCalcMode.MANUAL);
        sheet.setForceFormulaRecalculation(true);
        assertEquals(STCalcMode.AUTO, calcPr.getCalcMode());

        // Check
        sheet.setForceFormulaRecalculation(false);
        assertEquals(false, sheet.getForceFormulaRecalculation());
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr

        CTWorkbook ctWorkbook = wb.getCTWorkbook();
        assertFalse(ctWorkbook.isSetCalcPr());

        wb.setForceFormulaRecalculation(true); // resets the EngineId flag to zero

        CTCalcPr calcPr = ctWorkbook.getCalcPr();
        assertNotNull(calcPr);
        assertEquals(0, (int) calcPr.getCalcId());

        calcPr.setCalcId(100);
        assertTrue(wb.getForceFormulaRecalculation());

        wb.setForceFormulaRecalculation(true); // resets the EngineId flag to zero
        assertEquals(0, (int) calcPr.getCalcId());
        assertFalse(wb.getForceFormulaRecalculation());
    }
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr

     *
     * @see org.apache.poi.ss.usermodel.Workbook#setForceFormulaRecalculation(boolean)
     */
    @Override
    public void setForceFormulaRecalculation(boolean value) {
        CTCalcPr calcPr = getWorkbook().getCTWorkbook().getCalcPr();

        if(worksheet.isSetSheetCalcPr()) {
          // Change the current setting
          CTSheetCalcPr calc = worksheet.getSheetCalcPr();
          calc.setFullCalcOnLoad(value);
       }
       else if(value) {
          // Add the Calc block and set it
          CTSheetCalcPr calc = worksheet.addNewSheetCalcPr();
          calc.setFullCalcOnLoad(value);
       }
        if(value && calcPr != null && calcPr.getCalcMode() == STCalcMode.MANUAL) {
            calcPr.setCalcMode(STCalcMode.AUTO);
        }

    }
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr

     * @since 3.8
     */
    @Override
    public void setForceFormulaRecalculation(boolean value){
        CTWorkbook ctWorkbook = getCTWorkbook();
        CTCalcPr calcPr = ctWorkbook.isSetCalcPr() ? ctWorkbook.getCalcPr() : ctWorkbook.addNewCalcPr();
        // when set to 0, will tell Excel that it needs to recalculate all formulas
        // in the workbook the next time the file is opened.
        calcPr.setCalcId(0);

        if(value && calcPr.getCalcMode() == STCalcMode.MANUAL) {
            calcPr.setCalcMode(STCalcMode.AUTO);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.