Package com.extentech.formats.XLS

Examples of com.extentech.formats.XLS.Boundsheet


          }catch(Exception e) {
              ;
          }
      if(ptga instanceof PtgRef3d){
      PtgRef3d p3d = (PtgRef3d) ptga;
      Boundsheet b = p3d.getSheet(this.getWorkBook());
      Boundsheet[] ret = new Boundsheet[1];
      ret[0] = b;
      return ret;
    }else if(ptga instanceof PtgArea3d){
      PtgArea3d p3d = (PtgArea3d) ptga;
View Full Code Here


        }
       
        // usually don't need to set sheet on setlocation becuase uses parent_rec's sheet
        // cases of named range or if location sheet does not = parent_rec sheet, set sheet explicitly
        String sht= null// usual case, don't need to set sheet
      Boundsheet sh= parent_rec.getSheet();
        if (sh==null || (this.sheetname!=null && !this.sheetname.equals(sh.getSheetName()))) {
          if (sh==null || !GenericPtg.qualifySheetname(this.sheetname).equals(GenericPtg.qualifySheetname(sh.getSheetName())))
              sht= this.sheetname + "!";
        }
        // loop through the cols
        for (;startcol<=endcol;startcol++){
            // loop through the rows inside
View Full Code Here

   * @return Returns the refCell.
   */
  public BiffRec[] getRefCells() {
        double returnval = 0;
        try {
        Boundsheet bs= null; // this.parent_rec.getWorkBook().getWorkSheetByName(this.getSheetName());
        getSheetName();
          // handle misc sheets
          if(sheetname != null) {
              try{
                  bs = this.parent_rec.getWorkBook().getWorkSheetByName(sheetname);
              }catch(Exception ex) { // guard against NPEs
                  bs = parent_rec.getSheet();
              }
          }else {
              bs = parent_rec.getSheet();
              sheetname= bs.getSheetName()// 20080212 KSC
          }

//       TODO: check rc sanity here
        int[] startloc = firstPtg.getIntLocation();
            int startcol = startloc[1];
            int startrow = startloc[0];
            int[] endloc = lastPtg.getRealIntLocation();
            int endcol = endloc[1];
            int endrow = endloc[0];
            // loop through the cols
            int numcols= endcol-startcol;
            if (numcols<0) numcols= startcol-endcol;  // 20090521 KSC: may have range switched so that firstPtg>lastPtg (example in named ranges in tcr_formatted_2007.xlsm)                         
            numcols++;
            int numrows= endrow-startrow;
            if (numrows<0) numrows= startrow-endrow;  // 20090521 KSC: may have range switched so that firstPtg>lastPtg (example in named ranges in tcr_formatted_2007.xlsm)
            numrows++;
            int totcell= numcols*numrows;
            if(totcell==0)totcell++;
            if (totcell < 0) {
        Logger.logErr("PtgArea.getRefCells.  Error in Ptg locations: " + firstPtg.toString() + ":" + lastPtg.toString());
              totcell= 0;
            }
            refCell = new BiffRec[totcell];
            int rowctr = 0;           
            // 20090521 KSC: try to handle both cases i.e. ranges such that first<last or first>last
          if (startcol<endcol)endcol++;
          else endcol--;
            if (startrow<endrow)endrow++;
            else endrow--;
            while (startcol!=endcol) {
              int rowpos= startrow;
              while (rowpos!=endrow) {
                  Row r = bs.getRowByNumber(rowpos);
                    if (r!=null)
                        refCell[rowctr] = (BiffRec)r.getCell((short)(startcol));
                    rowctr++;
                    if (rowpos<endrow)rowpos++;
                    else rowpos--;
View Full Code Here

   * @return Returns the refCell.
   */
  public BiffRec[] getRefCells() {
    refCell = new BiffRec[1];
    try {
        Boundsheet bs = null;
            if((sheetname != null)&&(parent_rec!=null)){
                bs = this.parent_rec.getWorkBook().getWorkSheetByName(sheetname);
            }else if(parent_rec!=null){
                bs = parent_rec.getSheet();
            }
              refCell[0] = bs.getCell(rw,col);
    }catch(Exception ex) {;}
    return refCell;
  }    
View Full Code Here

   
    protected static byte[] getPrototypeSheet() {
      if (protosheet == null) try {
        WorkBookHandle bookhandle = new WorkBookHandle();
            com.extentech.formats.XLS.WorkBook book = bookhandle.getWorkBook();
            Boundsheet sheet = book.getWorkSheetByNumber( 0 );
            protosheet = sheet.getSheetBytes();
      } catch (Exception e) {
        throw new RuntimeException( e );
      }
     
      return protosheet;
View Full Code Here

          if(myfactory != null){
                int numsheets =mybook.getNumWorkSheets();
                if(numsheets == 0)throw new WorkSheetNotFoundException("WorkBook has No Sheets.");
                WorkSheetHandle[] sheets = new WorkSheetHandle[numsheets];
                for(int i =0;i<numsheets;i++){
                    Boundsheet bs = mybook.getWorkSheetByNumber(i);
                    bs.setWorkBook(this.mybook);
                    sheets[i] = new WorkSheetHandle(bs, this);
                }
                return sheets;
            }
          return null;
View Full Code Here

     @exception WorkSheetNotFoundException if the specified WorkSheet is
     not found in the WorkBook.
   */
   public WorkSheetHandle getWorkSheet(int sheetnum)
   throws WorkSheetNotFoundException{
       Boundsheet st = mybook.getWorkSheetByNumber(sheetnum);
       if(sheethandles.get(st.getSheetName())!=null)return (WorkSheetHandle)sheethandles.get(st.getSheetName());
       else {
           WorkSheetHandle shth = new WorkSheetHandle(st, this);
           sheethandles.put(st.getSheetName(),shth);
           return shth;
      
   }
View Full Code Here

        if(mybook.getWorkSheetByName(handstr)!=null)
          return (WorkSheetHandle)sheethandles.get(handstr);
        else throw new WorkSheetNotFoundException(handstr + " not found");
      }
        if(myfactory != null){
            Boundsheet bs = mybook.getWorkSheetByName(handstr);
            if(bs != null){
                bs.setWorkBook(this.mybook);
                WorkSheetHandle ret = new WorkSheetHandle(bs, this);
                sheethandles.put(handstr, ret);
                return ret;
            }else{
                throw new WorkSheetNotFoundException(handstr);
View Full Code Here

          throw new WorkBookException("Attempting to add worksheet with duplicate name. " + name + " already exists in " + this.toString(), WorkBookException.RUNTIME_ERROR);
      }catch(WorkSheetNotFoundException ex) {
          ; // good!
      }
     
        Boundsheet bo = null;
        try{
            ObjectInputStream ois = new ObjectInputStream(
                new ByteArrayInputStream( getPrototypeSheet() ) );
            bo = (Boundsheet) ois.readObject();
            mybook.addBoundsheet(bo, null, name, null, false);
View Full Code Here

     
      Iterator its = v.iterator();
     
     
      while(its.hasNext()){
        Boundsheet shtx = (Boundsheet)its.next();
        List fmtlist =shtx.getConditionalFormats();
        Iterator ixa = fmtlist.iterator();
        while(ixa.hasNext()){
          Condfmt cfm = (Condfmt)ixa.next();
          //cfm.initCells(this);  // added!
          int cfxe= cfm.getCfxe();
View Full Code Here

TOP

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

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.