Package org.apache.poi.hssf.util

Examples of org.apache.poi.hssf.util.CellReference


   */
  public void setPrintArea(int sheetIndex, int startColumn, int endColumn,
                int startRow, int endRow) {

    //using absolute references because they dont get copied and pasted anyway
    CellReference cell = new CellReference(startRow, startColumn, true, true);
    String reference = cell.toString();

    cell = new CellReference(endRow, endColumn, true, true);
    reference = reference+":"+cell.toString();

    setPrintArea(sheetIndex, reference);
  }
View Full Code Here


    /**
     * Takes in a String represnetation of a cell reference and fills out the
     * numeric fields.
     */
    public ReferencePtg(String cellref) {
        CellReference c= new CellReference(cellref);
        setRow((short) c.getRow());
        setColumn((short) c.getCol());
        setColRelative(!c.isColAbsolute());
        setRowRelative(!c.isRowAbsolute());
    }
View Full Code Here

    }

    public String toFormulaString(Workbook book)
    {
        //TODO -- should we store a cellreference instance in this ptg?? but .. memory is an issue, i believe!
        return (new CellReference(getRow(),getColumn(),!isRowRelative(),!isColRelative())).toString();
    }
View Full Code Here

     */
    public void setPrintArea(int sheetIndex, int startColumn, int endColumn,
                              int startRow, int endRow) {

        //using absolute references because they don't get copied and pasted anyway
        CellReference cell = new CellReference(startRow, startColumn, true, true);
        String reference = cell.formatAsString();

        cell = new CellReference(endRow, endColumn, true, true);
        reference = reference+":"+cell.formatAsString();

        setPrintArea(sheetIndex, reference);
    }
View Full Code Here

        field_2_row          = in.readShort();
        field_3_column        = in.readShort();
    }
   
    public Ref3DPtg(String cellref, short externIdx ) {
        CellReference c= new CellReference(cellref);
        setRow(c.getRow());
        setColumn(c.getCol());
        setColRelative(!c.isColAbsolute());
        setRowRelative(!c.isRowAbsolute());  
        setExternSheetIndex(externIdx);
    }
View Full Code Here

        setRowRelative(!c.isRowAbsolute());  
        setExternSheetIndex(externIdx);
    }

    public String toString() {
        CellReference cr = new CellReference(getRow(), getColumn(), !isRowRelative(),!isColRelative());
        StringBuffer sb = new StringBuffer();
        sb.append(getClass().getName());
        sb.append(" [");
        sb.append("sheetIx=").append(getExternSheetIndex());
        sb.append(" ! ");
        sb.append(cr.formatAsString());
        sb.append("]");
        return sb.toString();
    }
View Full Code Here

        String sheetName = getSheetName(book, field_1_index_extern_sheet);
        if(sheetName != null) {
            SheetNameFormatter.appendFormat(retval, sheetName);
            retval.append( '!' );
        }
        retval.append((new CellReference(getRow(),getColumn(),!isRowRelative(),!isColRelative())).formatAsString());
        return retval.toString();
    }
View Full Code Here

    private final static BitField   colRelative = BitFieldFactory.getInstance(0x4000);
    private final static BitField   columnMask      = BitFieldFactory.getInstance(0x3FFF);

    protected AreaPtgBase(String arearef) {
        AreaReference ar = new AreaReference(arearef);
        CellReference firstCell = ar.getFirstCell();
        CellReference lastCell = ar.getLastCell();
        setFirstRow(firstCell.getRow());
        setFirstColumn(firstCell.getCol());
        setLastRow(lastCell.getRow());
        setLastColumn(lastCell.getCol());
        setFirstColRelative(!firstCell.isColAbsolute());
        setLastColRelative(!lastCell.isColAbsolute());
        setFirstRowRelative(!firstCell.isRowAbsolute());
        setLastRowRelative(!lastCell.isRowAbsolute());       
    }
View Full Code Here

    // retrieve the cell at the named range and test its contents
    AreaReference aref = new AreaReference(aNamedCell.getReference());
    assertTrue("Should be exactly 1 cell in the named cell :'" +cellName+"'", aref.isSingleCell());

    CellReference cref = aref.getFirstCell();
    assertNotNull(cref);
    HSSFSheet s = wb.getSheet(cref.getSheetName());
    assertNotNull(s);
    HSSFRow r = sheet.getRow(cref.getRow());
    HSSFCell c = r.getCell(cref.getCol());
    String contents = c.getRichStringCellValue().getString();
    assertEquals("Contents of cell retrieved by its named reference", contents, cellValue);
  }
View Full Code Here

    int namedCellIdx = wb.getNameIndex(cname);
    HSSFName aNamedCell = wb.getNameAt(namedCellIdx);
    assertNotNull(aNamedCell);

    // retrieve the cell at the named range and test its contents
    CellReference cref = new CellReference(aNamedCell.getReference());
    assertNotNull(cref);
    HSSFSheet s = wb.getSheet(cref.getSheetName());
    HSSFRow r = sheet.getRow(cref.getRow());
    HSSFCell c = r.getCell(cref.getCol());
    String contents = c.getRichStringCellValue().getString();
    assertEquals("Contents of cell retrieved by its named reference", contents, cvalue);
  }
View Full Code Here

TOP

Related Classes of org.apache.poi.hssf.util.CellReference

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.