Package org.openxmlformats.schemas.spreadsheetml.x2006.main

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


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

     *
     * @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

        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

        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

     *
     * @return HorizontalAlignment - the type of alignment
     * @see org.apache.poi.ss.usermodel.HorizontalAlignment
     */
    public HorizontalAlignment getAlignmentEnum() {
        CTCellAlignment align = _cellXf.getAlignment();
        if(align != null && align.isSetHorizontal()) {
            return HorizontalAlignment.values()[align.getHorizontal().intValue()-1];
        }
        return HorizontalAlignment.GENERAL;
    }
View Full Code Here

     * Get the number of spaces to indent the text in the cell
     *
     * @return indent - number of spaces
     */
    public short getIndention() {
        CTCellAlignment align = _cellXf.getAlignment();
        return (short)(align == null ? 0 : align.getIndent());
    }
View Full Code Here

     * </p>
     *
     * @return rotation degrees (between 0 and 180 degrees)
     */
    public short getRotation() {
        CTCellAlignment align = _cellXf.getAlignment();
        return (short)(align == null ? 0 : align.getTextRotation());
    }
View Full Code Here

     *
     * @return the type of alignment, default value is {@link org.apache.poi.ss.usermodel.VerticalAlignment#BOTTOM}
     * @see org.apache.poi.ss.usermodel.VerticalAlignment
     */
    public VerticalAlignment getVerticalAlignmentEnum() {
        CTCellAlignment align = _cellXf.getAlignment();
        if(align != null && align.isSetVertical()) {
            return VerticalAlignment.values()[align.getVertical().intValue()-1];
        }
        return VerticalAlignment.BOTTOM;
    }
View Full Code Here

     * Whether the text should be wrapped
     *
     * @return  a boolean value indicating if the text in a cell should be line-wrapped within the cell.
     */
    public boolean getWrapText() {
        CTCellAlignment align = _cellXf.getAlignment();
        return align != null && align.getWrapText();
    }
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCalcPr

Copyright © 2018 www.massapicom. 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.