Package com.extentech.formats.XLS

Examples of com.extentech.formats.XLS.WorkBook


    return true;
  }
   
  //lookup Name object  in Workbook and return handle
  public Name getName(){
      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);
View Full Code Here


   * returns the string value of the name
    @see com.extentech.formats.XLS.formulas.Ptg#getValue()
   */
  public Object getValue(){
         
      WorkBook b = this.getParentRec().getSheet().getWorkBook();
      String externalname= null;
      try {
        externalname= b.getExternalName(ilbl);
      }
      catch (Exception e) {}
      if (externalname!=null)
        return externalname;
   
View Full Code Here

   */
    public void setName(String name){
    ptgId = 0x39// PtgNameX
    record = new byte[PTG_NAMEX_LENGTH];
    record[0] = ptgId;
    WorkBook b = this.getParentRec().getSheet().getWorkBook();
    ilbl= b.getExtenalNameNumber(name);
        ixti = (short)b.getExternSheet().getVirtualReference();
    byte[] bb= ByteTools.shortToLEBytes(ixti);
    record[1]= bb[0];
    record[2]= bb[1];
    byte[] bbb= ByteTools.cLongToLEBytes(ilbl);
    record[3]= bbb[0];
View Full Code Here

          pe.setParentRec(parent);
          pe.setLocation(s)
          return pe;
        }
      }
      WorkBook bk= parent.getWorkBook();

     
      String sht= "((?:\\\\?+.)*?!)?+";
      String rangeMatch= "(.*(:).*){2,}?"//matches 2 or more range ops (:'s)
      String opMatch= "(.*([ ,]).*)+";    //matches union or isect op  ( " " or ,)
      String m= sht + "((" + opMatch + ")|(" + rangeMatch +"))";
      // is address a complex range??
      if (address.matches(m) || range.indexOf("(")>-1) {
        //NOTE: this can be a MemFunc OR a MemArea --
        // PtgMemFunc= a NON-CONSTANT cell address, cell range address or cell range list
        // Whenever one operand of the reference subexpression is a function, a defined name, a 3D
        // reference, or an external reference (and no error occurs), a PtgMemFunc token is used.
        // PtgMemArea= constant cell address, cell range address, or cell range list on the same sheet
        PtgMemFunc pmf= new PtgMemFunc();
        pmf.setParentRec(parent);
        pmf.setLocation(address)// TODO HANDLE FUNCTION MEMFUNCS ALA OFFSET(x,y,0):OFFSET(x,y,0)
        ptg= pmf;
      } else if (range.indexOf(":") > 0) { // it's a range, either PtgRef3d or PtgArea3d     
        String[] ops= StringTool.getTokensUsingDelim(range, ":");
        if ((bk.getName(ops[0])!=null || bk.getName(ops[1])!=null)) {
          PtgMemFunc pmf= new PtgMemFunc();
          pmf.setParentRec(parent);
          pmf.setLocation(address);
          ptg= pmf;
        } else if (sh1!=null) {
View Full Code Here

   * @param f  parent formula rec
   */
  public void setExternalReference(String externalWorkbook) {
    if (this instanceof PtgArea3d) {
      PtgArea3d ptg= (PtgArea3d) this;     
      WorkBook b = parent_rec.getWorkBook();
      if (b==null
        b= parent_rec.getSheet().getWorkBook();
      short ixti= b.getExternSheet().addExternalSheetRef(externalWorkbook, ptg.getSheetName());    //20080714 KSC: May not reflect external reference!  this.sheetname);
      ptg.setIxti(ixti);
      if (ptg.firstPtg!=null) { // it's not a Ref3d
        ptg.firstPtg.updateRecord();
        ptg.lastPtg.updateRecord();
      }
          ptg.updateRecord();     
    } else if (this instanceof PtgRef3d) {  
      WorkBook b = parent_rec.getWorkBook();
      PtgRef3d pr= (PtgRef3d) this;
      if (b==null
        b= parent_rec.getSheet().getWorkBook();
      short ixti= b.getExternSheet().addExternalSheetRef(externalWorkbook, pr.getSheetName());    //20080714 KSC: May not reflect external reference!  this.sheetname);
      pr.setIxti(ixti);
    } else { // TODO: convert to ref3d?
      Logger.logWarn("PtgRef.setExternalReference: unable to convert ref");
    }
  }
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

   * For creating a ptg name from formula parser
   */
    public void setName(String name){
    record = new byte[5];
    record[0] = ptgId;
    WorkBook b = this.getParentRec().getWorkBook();
    ilbl = (short)b.getNameNumber(name);
        this.addListener();
    record[1] = (byte)ilbl;   
    }
View Full Code Here

TOP

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

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.