Package com.extentech.formats.XLS

Examples of com.extentech.formats.XLS.Name


      WorkBook b = this.getParentRec().getSheet().getWorkBook();
      // the externsheet reference is negative, there seems to be a problem
      // off the docs.  Just use a placeholder boundsheet, as the PtgRef3D internally will
      // get the value correctly
    //Externsheet x = b.getExternSheet();
      Name n = null;
     
      try{
          n = b.getName(ilbl);
        n.setSheet(this.getParentRec().getSheet());
      }catch(Exception e) {
          ; // it's an AddInFormula... -jm
      }
      //Boundsheet[] bound = x.getBoundSheets(ixti);
    return n;       
View Full Code Here


      }
      catch (Exception e) {}
      if (externalname!=null)
        return externalname;
   
    Name n = getName();
    return n.getCalculatedValue();
  }
View Full Code Here

      return true;
    }
    // lookup Name object  in Workbook and return handle
    public Name getName(){
        WorkBook b = this.getParentRec().getWorkBook();
        Name n = null;
        try{
          n = b.getName(ilbl);
        }catch(Exception ex){
       }
        return n;       
View Full Code Here

     *
     * returns the string value of the name
    @see com.extentech.formats.XLS.formulas.Ptg#getValue()
     */
    public Object getValue(){
      Name n = getName();
      try{
        Ptg[] p = n.getCellRangePtgs();
        if (p.length == 0){
          return new String("#NAME?");
        }else if (p.length == 1 || !(this.parent_rec instanceof com.extentech.formats.XLS.Array)){  // usual case
          return p[0].getValue();
        } else { // multiple values; create an array
View Full Code Here

      //return n;
    return new String("#NAME?");
    }
   
    public String getTextString(){
      Name n = getName();
      if(n==null)
          return "#NAME!";
      return n.getName();
    }
View Full Code Here

        } catch (Exception e) { ;}
      return null;
    }

    public void addListener() {
        Name n = this.getName();
        if (n!=null) {
            n.addIlblListener(this);
            this.storeName(n.getName());
        }   
       
    }
View Full Code Here

  }
 
  /** Gets the range specifying the titles printed on each page.
   */
  public String getTitles() {
    Name range = sheet.getName( "Built-in: PRINT_TITLES" );
    if (range == null) return null;
    return range.getExpressionString();
  }
View Full Code Here

   *  you want to set as a title e.g. $A:$B for columns A and B
   */
  // note:  MUST be in $ROW:$ROW or $COL:$COL format, for both
  // can be $R:$R, $C:$C for both
  public void setTitles (String range) {   
    Name name = sheet.getName( "Built-in: PRINT_TITLES" );
    if (name == null) try {
      name = new Name( sheet.getWorkBook(), "Print_Titles" );
      name.setBuiltIn( (byte)0x07 )//do before setNewScope as it blows out itab
      name.setNewScope( sheet.getSheetNum() + 1 );
    } catch (WorkSheetNotFoundException e) {
      // This shouldn't be possible.
      throw new Error ("sheet not found re-scoping name");
    }
    // pre-process range to ensure in proper format, ensure all absolute ($) refs +
    // handle wholerow-wholecol refs + complex ranges
    if (range==null) return// TODO: Do what?? remove??
    String[] ranges= range.split(",");
    range= "";
    for (int i= 0; i < ranges.length; i++) {
      if (i > 0// concatenate terms into one ptgmemfunc-style expression
        range+=",";
      String r= "";
      int[] rc= ExcelTools.getRangeCoords(ranges[i]);
      if (rc[0]==rc[2]) // varies by column
        r= "$" + ExcelTools.getAlphaVal(rc[1]) + ":$" + ExcelTools.getAlphaVal(rc[3]);
      if (rc[1]==rc[3]) {// varies by row
        r= "$" + rc[0] + ":$" + rc[2];
      }
      range+= sheet.getSheetName() + "!" + r;
    }
    name.setLocation( range );
}
View Full Code Here

   
        @return NameHandle a Named range in the WorkBook
    */
    public NameHandle getNamedRange(String rangename)
    throws CellNotFoundException{
        Name nand = mybook.getName(rangename.toUpperCase())// case-insensitive
        if(nand == null)throw new CellNotFoundException(rangename);
        return new NameHandle(nand, this);
    }
View Full Code Here

    *
    *@return NameHandle a Named range in the WorkBook that exists in the scope
*/
public NameHandle getNamedRangeInScope(String rangename)
throws CellNotFoundException{
    Name nand = mybook.getScopedName(rangename);
    if(nand == null)throw new CellNotFoundException(rangename);
    return new NameHandle(nand, this);
}
View Full Code Here

TOP

Related Classes of com.extentech.formats.XLS.Name

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.