Package org.apache.poi.ss.util

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


            // Given as explicit sheet id
            int sheetId = (int)ctName.getLocalSheetId();
            return workbook.getSheetName(sheetId);
        } else {
            String ref = getRefersToFormula();
            AreaReference areaRef = new AreaReference(ref);
            return areaRef.getFirstCell().getSheetName();
        }
    }
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(2, wb.getNumberOfNames());

        HSSFName name1 = wb.getNameAt(0);
        assertEquals("a", name1.getNameName());
        assertEquals("Sheet1!$A$1", name1.getRefersToFormula());
        new AreaReference(name1.getRefersToFormula());
        assertTrue("Successfully constructed first reference", true);

        HSSFName name2 = wb.getNameAt(1);
        assertEquals("b", name2.getNameName());
        assertEquals("Sheet1!#REF!", name2.getRefersToFormula());
        assertTrue(name2.isDeleted());
        try {
            new AreaReference(name2.getRefersToFormula());
            fail("attempt to supply an invalid reference to AreaReference constructor results in exception");
        } catch (StringIndexOutOfBoundsException e) { // TODO - use a different exception for this condition
            // expected during successful test
        }
    }
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

        ptg = new RefPtg(cr);
      } else {
        ptg = _book.get3DReferencePtg(cr, sheetIden);
      }
    } else {
      AreaReference areaRef = createAreaRef(part1, part2);

      if (sheetIden == null) {
        ptg = new AreaPtg(areaRef);
      } else {
        ptg = _book.get3DReferencePtg(areaRef, sheetIden);
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

    private int externalWorkbookNumber = -1;
    private String firstSheetName;
    private String lastSheetName;

  public Area3DPxg(int externalWorkbookNumber, SheetIdentifier sheetName, String arearef) {
    this(externalWorkbookNumber, sheetName, new AreaReference(arearef));
  }
View Full Code Here

            this.lastSheetName = null;
        }
    }

    public Area3DPxg(SheetIdentifier sheetName, String arearef) {
        this(sheetName, new AreaReference(arearef));
    }
View Full Code Here

        assertEquals(2, wb.getNumberOfNames());

        HSSFName name1 = wb.getNameAt(0);
        assertEquals("a", name1.getNameName());
        assertEquals("Sheet1!$A$1", name1.getRefersToFormula());
        new AreaReference(name1.getRefersToFormula());
        assertTrue("Successfully constructed first reference", true);

        HSSFName name2 = wb.getNameAt(1);
        assertEquals("b", name2.getNameName());
        assertEquals("Sheet1!#REF!", name2.getRefersToFormula());
        assertTrue(name2.isDeleted());
        try {
            new AreaReference(name2.getRefersToFormula());
            fail("attempt to supply an invalid reference to AreaReference constructor results in exception");
        } catch (IllegalArgumentException e) { // TODO - use a stronger typed exception for this condition
            // expected during successful test
        }
    }
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.