Package org.apache.poi.ss.util

Examples of org.apache.poi.ss.util.AreaReference


 
  private int field_1_index_extern_sheet;


  public Area3DPtg(String arearef, int externIdx) {
    super(new AreaReference(arearef));
    setExternSheetIndex(externIdx);
  }
View Full Code Here


        ptg = new RefPtg(cr);
      } else {
        ptg = new Ref3DPtg(cr, extIx);
      }
    } else {
      AreaReference areaRef = createAreaRef(part1, part2);

      if (sheetIden == null) {
        ptg = new AreaPtg(areaRef);
      } else {
        ptg = new Area3DPtg(areaRef, extIx);
View Full Code Here

      return AreaReference.getWholeRow(part1.getRep(), part2.getRep());
    }
    if (part1.isColumn()) {
      return AreaReference.getWholeColumn(part1.getRep(), part2.getRep());
    }
    return new AreaReference(part1.getCellReference(), part2.getCellReference());
  }
View Full Code Here

  }
  public AreaPtg(LittleEndianInput in)  {
    super(in);
  }
  public AreaPtg(String arearef) {
    super(new AreaReference(arearef));
  }
View Full Code Here

        ptg = new RefPtg(cr);
      } else {
        ptg = new Ref3DPtg(cr, extIx);
      }
    } else {
      AreaReference areaRef = createAreaRef(part1, part2);

      if (sheetIden == null) {
        ptg = new AreaPtg(areaRef);
      } else {
        ptg = new Area3DPtg(areaRef, extIx);
View Full Code Here

      return AreaReference.getWholeRow(part1.getRep(), part2.getRep());
    }
    if (part1.isColumn()) {
      return AreaReference.getWholeColumn(part1.getRep(), part2.getRep());
    }
    return new AreaReference(part1.getCellReference(), part2.getCellReference());
  }
View Full Code Here

       assertEquals("Abc,1", sheet.getSheetName());
      
       Name name = wb.getName("Intekon.ProdCodes");
       assertEquals("'Abc,1'!$A$1:$A$2", name.getRefersToFormula());
      
       AreaReference ref = new AreaReference(name.getRefersToFormula());
       assertEquals(0, ref.getFirstCell().getRow());
       assertEquals(0, ref.getFirstCell().getCol());
       assertEquals(1, ref.getLastCell().getRow());
       assertEquals(0, ref.getLastCell().getCol());
    }
View Full Code Here

        int namedCellIdx = wb.getNameIndex(cellName);
        Name aNamedCell = wb.getNameAt(namedCellIdx);
        assertNotNull(aNamedCell);

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

        CellReference cref = aref.getFirstCell();
        assertNotNull(cref);
        Sheet s = wb.getSheet(cref.getSheetName());
        assertNotNull(s);
        Row r = sheet.getRow(cref.getRow());
        Cell c = r.getCell(cref.getCol());
View Full Code Here

*
*/
public final class TestAreaReference extends TestCase {

    public void testAreaRef1() {
        AreaReference ar = new AreaReference("$A$1:$B$2");
        assertFalse("Two cells expected", ar.isSingleCell());
        CellReference cf = ar.getFirstCell();
        assertTrue("row is 4",cf.getRow()==0);
        assertTrue("col is 1",cf.getCol()==0);
        assertTrue("row is abs",cf.isRowAbsolute());
        assertTrue("col is abs",cf.isColAbsolute());
        assertTrue("string is $A$1",cf.formatAsString().equals("$A$1"));

        cf = ar.getLastCell();
        assertTrue("row is 4",cf.getRow()==1);
        assertTrue("col is 1",cf.getCol()==1);
        assertTrue("row is abs",cf.isRowAbsolute());
        assertTrue("col is abs",cf.isColAbsolute());
        assertTrue("string is $B$2",cf.formatAsString().equals("$B$2"));

        CellReference[] refs = ar.getAllReferencedCells();
        assertEquals(4, refs.length);

        assertEquals(0, refs[0].getRow());
        assertEquals(0, refs[0].getCol());
        assertNull(refs[0].getSheetName());
View Full Code Here

    /**
     * References failed when sheet names were being used
     * Reported by Arne.Clauss@gedas.de
     */
    public void testReferenceWithSheet() {
        AreaReference ar;

        ar = new AreaReference("Tabelle1!B5:B5");
        assertTrue(ar.isSingleCell());
        TestCellReference.confirmCell(ar.getFirstCell(), "Tabelle1", 4, 1, false, false, "Tabelle1!B5");

        assertEquals(1, ar.getAllReferencedCells().length);


        ar = new AreaReference("Tabelle1!$B$5:$B$7");
        assertFalse(ar.isSingleCell());

        TestCellReference.confirmCell(ar.getFirstCell(), "Tabelle1", 4, 1, true, true, "Tabelle1!$B$5");
        TestCellReference.confirmCell(ar.getLastCell(), "Tabelle1", 6, 1, true, true, "Tabelle1!$B$7");

        // And all that make it up
        CellReference[] allCells = ar.getAllReferencedCells();
        assertEquals(3, allCells.length);
        TestCellReference.confirmCell(allCells[0], "Tabelle1", 4, 1, true, true, "Tabelle1!$B$5");
        TestCellReference.confirmCell(allCells[1], "Tabelle1", 5, 1, true, true, "Tabelle1!$B$6");
        TestCellReference.confirmCell(allCells[2], "Tabelle1", 6, 1, true, true, "Tabelle1!$B$7");
    }
View Full Code Here

TOP

Related Classes of org.apache.poi.ss.util.AreaReference

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.