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

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


        return sharedFormulas.get(sid);
    }

    void onReadCell(XSSFCell cell){
        //collect cells holding shared formulas
        CTCell ct = cell.getCTCell();
        CTCellFormula f = ct.getF();
        if (f != null && f.getT() == STCellFormulaType.SHARED && f.isSetRef() && f.getStringValue() != null) {
            // save a detached  copy to avoid XmlValueDisconnectedException,
            // this may happen when the master cell of a shared formula is changed
            CTCellFormula sf = (CTCellFormula)f.copy();
            CellRangeAddress sfRef = CellRangeAddress.valueOf(sf.getRef());
View Full Code Here


    /**
     * Blanks this cell. Blank cells have no formula or value but may have styling.
     * This method erases all the data previously associated with this cell.
     */
    private void setBlank(){
        CTCell blank = CTCell.Factory.newInstance();
        blank.setR(_cell.getR());
        if(_cell.isSetS()) blank.setS(_cell.getS());
        _cell.set(blank);
    }
View Full Code Here

     * @see Cell#CELL_TYPE_STRING
     */
    public XSSFCell createCell(int columnIndex, int type) {
        if(columnIndex < 0) throw new IllegalArgumentException("columnIndex must be >= 0, was " + columnIndex);

        CTCell ctcell = CTCell.Factory.newInstance();
        XSSFCell xcell = new XSSFCell(this, ctcell);
        xcell.setCellNum(columnIndex);
        if (type != Cell.CELL_TYPE_BLANK) {
          xcell.setCellType(type);
        }
View Full Code Here

            XSSFCell cell = (XSSFCell)c;

            //remove the reference in the calculation chain
            if(calcChain != null) calcChain.removeItem((int)sheet.sheet.getSheetId(), cell.getReference());

            CTCell ctCell = cell.getCTCell();
            String r = new CellReference(rownum, cell.getColumnIndex()).formatAsString();
            ctCell.setR(r);

            if(ctCell.isSetF()){
                CTCellFormula f = ctCell.getF();
                String fmla = f.getStringValue();
                if(fmla.length() > 0) {
                    String shiftedFmla = shiftFormula(fmla, n);
                    f.setStringValue(shiftedFmla);
                }
View Full Code Here

        cell.setCellValue(""); //set precalculated value
    }
   
    public void testSetGetStringInline() throws Exception {
        CTCell rawCell = CTCell.Factory.newInstance();
        XSSFRow row = createParentObjects();
        XSSFCell cell = new XSSFCell(row, rawCell);
       
        // Default is shared string mode, so have to do this explicitly
        rawCell.setT(STCellType.INLINE_STR);
       
        assertEquals(STCellType.INT_INLINE_STR, rawCell.getT().intValue());
        assertEquals(Cell.CELL_TYPE_STRING, cell.getCellType());
        assertEquals("", cell.getRichStringCellValue().getString());
       
        cell.setCellValue(new XSSFRichTextString("Foo"));
        assertEquals(STCellType.INT_INLINE_STR, rawCell.getT().intValue());
        assertEquals(Cell.CELL_TYPE_STRING, cell.getCellType());
        assertEquals("Foo", cell.getRichStringCellValue().getString());
       
        // To number and back to string, stops being inline
        cell.setCellValue(1.4);
        cell.setCellValue(new XSSFRichTextString("Foo2"));
        assertEquals(STCellType.INT_S, rawCell.getT().intValue());
        assertEquals(Cell.CELL_TYPE_STRING, cell.getCellType());
        assertEquals("Foo2", cell.getRichStringCellValue().getString());
    }
View Full Code Here

        row.createCell(3);

        // Set a comment for C10 cell
        cell.setCellComment(comment);
       
        CTCell ctCell = cell.getCTCell();
    assertNotNull(ctCell);
    assertEquals("C10", ctCell.getR());
    assertEquals(TEST_C10_AUTHOR, comment.getAuthor());
    }
View Full Code Here

    /**
     * Blanks this cell. Blank cells have no formula or value but may have styling.
     * This method erases all the data previously associated with this cell.
     */
    private void setBlank(){
        CTCell blank = CTCell.Factory.newInstance();
        blank.setR(cell.getR());
        cell.set(blank);
    }
View Full Code Here

      fra.setParsedExpression(ptgs);
    }
  }
 
  private static void shiftXSSFFormulas(PtgShifter shifter, int sheetIndex, XSSFCell cell, XSSFWorkbook book) {
        CTCell ctCell = cell.getCTCell();
        if (ctCell.isSetF()) {
            CTCellFormula f = ctCell.getF();
            String formula = f.getStringValue();
            if (formula.length() > 0) {
                String shiftedFormula = shiftXSSFFormula(book, sheetIndex, formula, shifter);
                if (shiftedFormula != null) {
                    f.setStringValue(shiftedFormula);
View Full Code Here

    /**
     * Blanks this cell. Blank cells have no formula or value but may have styling.
     * This method erases all the data previously associated with this cell.
     */
    private void setBlank(){
        CTCell blank = CTCell.Factory.newInstance();
        blank.setR(_cell.getR());
        blank.setS(_cell.getS());
        _cell.set(blank);
    }
View Full Code Here

     * @see Cell#CELL_TYPE_FORMULA
     * @see Cell#CELL_TYPE_NUMERIC
     * @see Cell#CELL_TYPE_STRING
     */
    public XSSFCell createCell(int columnIndex, int type) {
        CTCell ctcell = CTCell.Factory.newInstance();
        XSSFCell xcell = new XSSFCell(this, ctcell);
        xcell.setCellNum(columnIndex);
        if (type != Cell.CELL_TYPE_BLANK) {
          xcell.setCellType(type);
        }
View Full Code Here

TOP

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

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.