Examples of CTWorkbook


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

    @Test
    public void recalcId() {
        XSSFWorkbook wb = new XSSFWorkbook();
        assertFalse(wb.getForceFormulaRecalculation());
        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());
View Full Code Here

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

        return cs.toString().indexOf(searchChar.toString(), start);
    }

    public void testAddPivotCache() {
        XSSFWorkbook wb = new XSSFWorkbook();
        CTWorkbook ctWb = wb.getCTWorkbook();
        CTPivotCache pivotCache = wb.addPivotCache("0");
        //Ensures that pivotCaches is initiated
        assertTrue(ctWb.isSetPivotCaches());
        assertSame(pivotCache, ctWb.getPivotCaches().getPivotCacheArray(0));
        assertEquals("0", pivotCache.getId());
    }
View Full Code Here

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

     * workbook values when the workbook is opened
     * @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) {
View Full Code Here

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

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

    /**
     * Add pivotCache to the workbook
     */
    @Beta
    protected CTPivotCache addPivotCache(String rId) {
        CTWorkbook ctWorkbook = getCTWorkbook();
        CTPivotCaches caches;
        if (ctWorkbook.isSetPivotCaches()) {
            caches = ctWorkbook.getPivotCaches();
        } else {
            caches = ctWorkbook.addNewPivotCaches();
        }
        CTPivotCache cache = caches.addNewPivotCache();

        int tableId = getPivotTables().size()+1;
        cache.setCacheId(tableId);
View Full Code Here

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

  }

    public void testRecalcId() {
        XSSFWorkbook wb = new XSSFWorkbook();
        assertFalse(wb.getForceFormulaRecalculation());
        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());
View Full Code Here

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

                        sheetMap.put(rel.getId(), wb.getPackage().getPart(relName));
                    }
                }
                //step 2. Read array of CTSheet elements, wrap it in a ArayList and construct an iterator
                //Note, using XMLBeans might be expensive, consider refactoring to use SAX or a plain regexp search
                CTWorkbook wbBean = WorkbookDocument.Factory.parse(wb.getInputStream()).getWorkbook();
                sheetIterator = Arrays.asList(wbBean.getSheets().getSheetArray()).iterator();
            } catch (InvalidFormatException e){
                throw new POIXMLException(e);
            } catch (XmlException e){
                throw new POIXMLException(e);
            }
View Full Code Here

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

    assertSame(sheet2, workbook.getSheetAt(1));
    workbook.setSheetOrder("sheet2", 0);
    assertSame(sheet2, workbook.getSheetAt(0));
    assertSame(sheet1, workbook.getSheetAt(1));
    // Test reordering of CTSheets
    CTWorkbook ctwb = workbook.getCTWorkbook();
    CTSheet[] ctsheets = ctwb.getSheets().getSheetArray();
    assertEquals("sheet2", ctsheets[0].getName());
    assertEquals("sheet1", ctsheets[1].getName());
   
    // Borderline case: only one sheet
    workbook = new XSSFWorkbook();
View Full Code Here

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

        assertSame(sheet2, workbook.getSheetAt(1));
        workbook.setSheetOrder("sheet2", 0);
        assertSame(sheet2, workbook.getSheetAt(0));
        assertSame(sheet1, workbook.getSheetAt(1));
        // Test reordering of CTSheets
        CTWorkbook ctwb = workbook.getWorkbook();
        CTSheet[] ctsheets = ctwb.getSheets().getSheetArray();
        assertEquals("sheet2", ctsheets[0].getName());
        assertEquals("sheet1", ctsheets[1].getName());
       
        // Borderline case: only one sheet
        workbook = new XSSFWorkbook();
View Full Code Here

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

  }

    public void testRecalcId() {
        XSSFWorkbook wb = new XSSFWorkbook();
        assertFalse(wb.getForceFormulaRecalculation());
        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());
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.