亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? readformularecord.java

?? java開發(fā)文檔之excel:jexcelapi_2_6_3.tar
?? JAVA
字號:
/*********************************************************************
*
*      Copyright (C) 2002 Andrew Khan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/

package jxl.write.biff;

import common.Assert;
import common.Logger;

import jxl.CellReferenceHelper;
import jxl.CellType;
import jxl.FormulaCell;
import jxl.Sheet;
import jxl.WorkbookSettings;
import jxl.biff.FormattingRecords;
import jxl.biff.FormulaData;
import jxl.biff.IntegerHelper;
import jxl.biff.Type;
import jxl.biff.WorkbookMethods;
import jxl.biff.formula.ExternalSheet;
import jxl.biff.formula.FormulaException;
import jxl.biff.formula.FormulaParser;
import jxl.write.WritableCell;

/**
 * A formula record.  This is invoked when copying a formula from a
 * read only spreadsheet
 * This method implements the FormulaData interface to allow the copying
 * of writable sheets
 */
class ReadFormulaRecord extends CellValue implements FormulaData
{
  /**
   * The logger
   */
  private static Logger logger = Logger.getLogger(ReadFormulaRecord.class);

  /**
   * The underlying formula from the read sheet
   */
  private FormulaData formula;

  /**
   * The formula parser
   */
  private FormulaParser parser;

  /**
   * Constructor
   * 
   * @param f the formula to copy
   */
  protected ReadFormulaRecord(FormulaData f)
  {
    super(Type.FORMULA, f);
    formula = f;
  }

  protected final byte[] getCellData()
  {
    return super.getData();
  }

  /**
   * An exception has occurred, so produce some appropriate dummy
   * cell contents.  This may be overridden by subclasses
   * if they require specific handling
   *
   * @return the bodged data
   */
  protected byte[] handleFormulaException()
  {
    byte[] expressiondata = null;
    byte[] celldata = super.getData();

    // Generate an appropriate dummy formula
    WritableWorkbookImpl w = getSheet().getWorkbook();
    parser = new FormulaParser(getContents(), w, w, 
                               w.getSettings());

    // Get the bytes for the dummy formula
    try
    {
      parser.parse();
    }
    catch(FormulaException e2)
    {
      logger.warn(e2.getMessage());
      parser = new FormulaParser("\"ERROR\"", w, w, w.getSettings());
      try {parser.parse();} 
      catch(FormulaException e3) {Assert.verify(false);}
    }
    byte[] formulaBytes = parser.getBytes();
    expressiondata = new byte[formulaBytes.length + 16];
    IntegerHelper.getTwoBytes(formulaBytes.length, expressiondata, 14);
    System.arraycopy(formulaBytes, 0, expressiondata, 16, 
                     formulaBytes.length);

    // Set the recalculate on load bit
    expressiondata[8] |= 0x02;
    
    byte[] data = new byte[celldata.length + 
                           expressiondata.length];
    System.arraycopy(celldata, 0, data, 0, celldata.length);
    System.arraycopy(expressiondata, 0, data, 
                     celldata.length, expressiondata.length);
    return data;
  }

  /**
   * Gets the binary data for output to file
   * 
   * @return the binary data
   */
  public byte[] getData()
  {
    // Take the superclass cell data to take into account cell 
    // rationalization
    byte[] celldata = super.getData();
    byte[] expressiondata = null;

    try
    {
      if (parser == null)
      {
        expressiondata = formula.getFormulaData();
      }
      else
      {
        byte[]  formulaBytes = parser.getBytes();
        expressiondata = new byte[formulaBytes.length + 16];
        IntegerHelper.getTwoBytes(formulaBytes.length, expressiondata, 14);
        System.arraycopy(formulaBytes, 0, expressiondata, 16, 
                         formulaBytes.length);
      }

      // Set the recalculate on load bit
      expressiondata[8] |= 0x02;
    
      byte[] data = new byte[celldata.length + 
                             expressiondata.length];
      System.arraycopy(celldata, 0, data, 0, celldata.length);
      System.arraycopy(expressiondata, 0, data, 
                       celldata.length, expressiondata.length);
      return data;
    }
    catch (FormulaException e)
    {
      // Something has gone wrong trying to read the formula data eg. it
      // might be unsupported biff7 data
      logger.warn
        (CellReferenceHelper.getCellReference(getColumn(), getRow()) + 
         " " + e.getMessage());
      return handleFormulaException();
    }
  }

  /**
   * Returns the content type of this cell
   * 
   * @return the content type for this cell
   */
  public CellType getType()
  {
    return formula.getType();
  }

  /**
   * Quick and dirty function to return the contents of this cell as a string.
   *
   * @return the contents of this cell as a string
   */
  public String getContents()
  {
    return formula.getContents();
  }

  /**
   * Gets the raw bytes for the formula.  This will include the
   * parsed tokens array.  Used when copying spreadsheets
   *
   * @return the raw record data
   */
  public byte[] getFormulaData() throws FormulaException
  {
    byte[] d = formula.getFormulaData();
    byte[] data = new byte[d.length];

    System.arraycopy(d, 0, data, 0, d.length);
      
    // Set the recalculate on load bit
    data[8] |= 0x02;
    
    return data;
  }

  /**
   * Implementation of the deep copy function
   *
   * @param col the column which the new cell will occupy
   * @param row the row which the new cell will occupy
   * @return  a copy of this cell, which can then be added to the sheet
   */
  public WritableCell copyTo(int col, int row)
  {
    return new FormulaRecord(col, row, this);
  }

  /**
   * Overrides the method in the base class to add this to the Workbook's
   * list of maintained formulas
   * 
   * @param fr the formatting records
   * @param ss the shared strings used within the workbook
   * @param s the sheet this is being added to
   */
  void setCellDetails(FormattingRecords fr, SharedStrings ss, 
                      WritableSheetImpl s)
  {
    super.setCellDetails(fr, ss, s);
    s.getWorkbook().addRCIRCell(this);
  }

  /**
   * Called when a column is inserted on the specified sheet.  Notifies all
   * RCIR cells of this change. The default implementation here does nothing
   *
   * @param s the sheet on which the column was inserted
   * @param sheetIndex the sheet index on which the column was inserted
   * @param col the column number which was inserted
   */
  void columnInserted(Sheet s, int sheetIndex, int col)
  {
    try
    {
      if (parser == null)
      {
        byte[] formulaData = formula.getFormulaData();
        byte[] formulaBytes = new byte[formulaData.length - 16];
        System.arraycopy(formulaData, 16, 
                         formulaBytes, 0, formulaBytes.length);
        parser = new FormulaParser(formulaBytes, 
                                   this, 
                                   getSheet().getWorkbook(), 
                                   getSheet().getWorkbook(), 
                                   getSheet().getWorkbookSettings());
        parser.parse();
      }

      parser.columnInserted(sheetIndex, col, s == getSheet());
    }
    catch (FormulaException e)
    {
      logger.warn("cannot insert column within formula:  " + e.getMessage());
    }
  }

  /**
   * Called when a column is removed on the specified sheet.  Notifies all
   * RCIR cells of this change. The default implementation here does nothing
   *
   * @param s the sheet on which the column was inserted
   * @param sheetIndex the sheet index on which the column was inserted
   * @param col the column number which was inserted
   */
  void columnRemoved(Sheet s, int sheetIndex, int col)
  {
    try
    {
      if (parser == null)
      {
        byte[] formulaData = formula.getFormulaData();
        byte[] formulaBytes = new byte[formulaData.length - 16];
        System.arraycopy(formulaData, 16, 
                         formulaBytes, 0, formulaBytes.length);
        parser = new FormulaParser(formulaBytes, 
                                   this, 
                                   getSheet().getWorkbook(), 
                                   getSheet().getWorkbook(), 
                                   getSheet().getWorkbookSettings());
        parser.parse();
      }

      parser.columnRemoved(sheetIndex, col, s == getSheet());
    }
    catch (FormulaException e)
    {
      logger.warn("cannot remove column within formula:  " + e.getMessage());
    }
  }

  /**
   * Called when a row is inserted on the specified sheet.  Notifies all
   * RCIR cells of this change. The default implementation here does nothing
   *
   * @param s the sheet on which the column was inserted
   * @param sheetIndex the sheet index on which the column was inserted
   * @param row the column number which was inserted
   */
  void rowInserted(Sheet s, int sheetIndex, int row)
  {
    try
    {
      if (parser == null)
      {
        byte[] formulaData = formula.getFormulaData();
        byte[] formulaBytes = new byte[formulaData.length - 16];
        System.arraycopy(formulaData, 16, 
                         formulaBytes, 0, formulaBytes.length);
        parser = new FormulaParser(formulaBytes, 
                                   this, 
                                   getSheet().getWorkbook(), 
                                   getSheet().getWorkbook(), 
                                   getSheet().getWorkbookSettings());
        parser.parse();
      }

      parser.rowInserted(sheetIndex, row, s == getSheet());
    }
    catch (FormulaException e)
    {
      logger.warn("cannot insert row within formula:  " + e.getMessage());
    }
  }

  /**
   * Called when a row is inserted on the specified sheet.  Notifies all
   * RCIR cells of this change. The default implementation here does nothing
   *
   * @param s the sheet on which the row was removed
   * @param sheetIndex the sheet index on which the column was removed
   * @param row the column number which was removed
   */
  void rowRemoved(Sheet s, int sheetIndex, int row)
  {
    try
    {
      if (parser == null)
      {
        byte[] formulaData = formula.getFormulaData();
        byte[] formulaBytes = new byte[formulaData.length - 16];
        System.arraycopy(formulaData, 16, 
                         formulaBytes, 0, formulaBytes.length);
        parser = new FormulaParser(formulaBytes, 
                                   this, 
                                   getSheet().getWorkbook(), 
                                   getSheet().getWorkbook(), 
                                   getSheet().getWorkbookSettings());
        parser.parse();
      }

      parser.rowRemoved(sheetIndex, row, s == getSheet());
    }
    catch (FormulaException e)
    {
      logger.warn("cannot remove row within formula:  " + e.getMessage());
    }
  }

  /**
   * Accessor for the read formula
   *
   * @return the read formula
   */
  protected FormulaData getReadFormula()
  {
    return formula;
  }

  /**
   * Accessor for the read formula
   *
   * @return the read formula
   */
  public String getFormula() throws FormulaException
  {
    return ( (FormulaCell) formula).getFormula();
  }

  /**
   * If this formula was on an imported sheet, check that
   * cell references to another sheet are warned appropriately
   * 
   * @return TRUE if this formula was able to be imported, FALSE otherwise
   */
  public boolean handleImportedCellReferences(ExternalSheet es,
                                              WorkbookMethods mt,
                                              WorkbookSettings ws)
  {
    try
    {
      if (parser == null)
      {
        byte[] formulaData = formula.getFormulaData();
        byte[] formulaBytes = new byte[formulaData.length - 16];
        System.arraycopy(formulaData, 16, 
                         formulaBytes, 0, formulaBytes.length);
        parser = new FormulaParser(formulaBytes, 
                                   this, 
                                   es, mt, ws);
        parser.parse();
      }

      return parser.handleImportedCellReferences();
    }
    catch (FormulaException e)
    {
      logger.warn("cannot import formula:  " + e.getMessage());
      return false;
    }
  }
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品午夜久久福利影院| 免费黄网站欧美| 日韩成人精品在线观看| 国产精品乡下勾搭老头1| 不卡电影一区二区三区| 色婷婷av一区二区三区之一色屋| 91精品综合久久久久久| 中文字幕中文在线不卡住| 日韩电影一区二区三区四区| 91免费版在线看| 国产情人综合久久777777| 日本中文字幕一区二区视频| 91福利在线播放| 中文字幕在线播放不卡一区| 久久精品国产澳门| 5858s免费视频成人| 亚洲精品中文字幕乱码三区| 成人永久aaa| 国产日产精品1区| 国产精品18久久久久| 日韩欧美一级片| 免费在线看一区| 欧美放荡的少妇| 天天av天天翘天天综合网 | 欧美日韩一级视频| 欧美一区二区网站| 视频在线在亚洲| 欧美精品日韩一本| 亚洲高清一区二区三区| 91久久香蕉国产日韩欧美9色| 中文字幕一区二区三区在线观看 | 91免费看`日韩一区二区| 亚洲国产精品国自产拍av| 国产成人在线视频网址| 久久午夜国产精品| 国产精品1024| 国产精品成人午夜| 色婷婷狠狠综合| 日韩精品色哟哟| 日韩欧美在线1卡| 国产精品18久久久久久久久久久久| 久久亚洲影视婷婷| 成人一级片在线观看| 国产精品久久久久久亚洲伦| 99热99精品| 亚洲五月六月丁香激情| 欧美日本韩国一区二区三区视频| 午夜精品久久久久久久99樱桃| 67194成人在线观看| 久久电影国产免费久久电影| 国产亚洲精品aa| 97久久超碰国产精品电影| 亚洲一区二区三区四区在线| 欧美日本在线看| 日韩影院免费视频| 2欧美一区二区三区在线观看视频| 麻豆成人91精品二区三区| 26uuu欧美| 99精品欧美一区| 亚洲成av人影院| 精品国产亚洲在线| 色中色一区二区| 久久精品99国产国产精| 亚洲欧洲日韩在线| 91精品在线免费| 99久久精品久久久久久清纯| 天天色 色综合| 国产精品久久久久桃色tv| 欧美电影在线免费观看| 国产传媒久久文化传媒| 亚洲成人动漫在线观看| 国产日韩亚洲欧美综合| 欧美在线免费观看视频| 国产精品综合视频| 亚洲午夜精品在线| 中文字幕国产一区二区| 91精品久久久久久久99蜜桃| av成人免费在线观看| 久久国产麻豆精品| 尤物在线观看一区| 久久久久国产精品麻豆| 欧美日韩精品三区| 不卡在线观看av| 极品美女销魂一区二区三区免费| 亚洲精品视频自拍| 国产色爱av资源综合区| 日韩欧美一区电影| 91九色02白丝porn| 东方欧美亚洲色图在线| 久久99国产精品免费| 亚洲福利一二三区| 亚洲色图都市小说| 国产精品视频看| 久久色在线观看| 欧美tickling网站挠脚心| 欧美日韩日本视频| 色婷婷综合久久久中文一区二区| 高清beeg欧美| 国产在线精品免费av| 美女脱光内衣内裤视频久久影院| 亚洲综合清纯丝袜自拍| 亚洲欧美日韩中文播放| 欧美激情在线观看视频免费| 久久久三级国产网站| 欧美mv日韩mv亚洲| 日韩欧美国产三级电影视频| 欧美日韩国产大片| 欧美日本不卡视频| 欧美日韩一区二区欧美激情| 欧美在线观看视频在线| 欧美伊人久久久久久午夜久久久久| 9i看片成人免费高清| av电影一区二区| 91在线视频播放地址| 91老师片黄在线观看| 色老综合老女人久久久| 色老汉av一区二区三区| 在线观看成人免费视频| 精品视频一区 二区 三区| 欧美日韩国产在线观看| 欧美高清视频www夜色资源网| 在线国产电影不卡| 欧美日韩不卡在线| 日韩一区二区中文字幕| 日韩精品一区在线| 国产午夜精品一区二区三区四区| 国产欧美日韩麻豆91| 1024亚洲合集| 亚洲一区二区三区四区中文字幕| 亚洲国产一区二区三区| 人人精品人人爱| 国产精品一区二区果冻传媒| 成人激情免费电影网址| 色婷婷精品大视频在线蜜桃视频| 欧美色图12p| 欧美精品一区二区久久婷婷| 国产精品女主播在线观看| 一区二区不卡在线播放 | 粉嫩绯色av一区二区在线观看 | 国产精品婷婷午夜在线观看| 亚洲精品水蜜桃| 秋霞影院一区二区| 成人精品亚洲人成在线| 欧美色窝79yyyycom| 欧美成人一区二区三区片免费 | 亚洲综合精品自拍| 久久精品久久综合| 不卡av电影在线播放| 在线成人av网站| 国产片一区二区| 亚洲成人一区二区| 国产精品一级黄| 精品1区2区3区| 国产片一区二区三区| 三级一区在线视频先锋 | 精品无人区卡一卡二卡三乱码免费卡| 国产精品一色哟哟哟| 欧美午夜寂寞影院| 亚洲国产精品ⅴa在线观看| 亚洲第一成人在线| 国产成人亚洲综合a∨婷婷 | 色视频欧美一区二区三区| 欧美一区二视频| 亚洲欧洲三级电影| 麻豆一区二区在线| 欧洲一区在线观看| 国产精品日产欧美久久久久| 蜜臀av性久久久久蜜臀aⅴ| 91丝袜美腿高跟国产极品老师 | 久久婷婷一区二区三区| 亚洲一级二级三级在线免费观看| 韩国av一区二区三区| 欧美调教femdomvk| 亚洲天堂免费在线观看视频| 美女一区二区三区在线观看| 91福利精品第一导航| 欧美国产一区二区| 韩国女主播一区| 欧美一区二区三区免费在线看| 国产精品传媒视频| 国产乱码精品一品二品| 91精品欧美一区二区三区综合在| 一区二区视频免费在线观看| 成人美女视频在线观看| 久久影音资源网| 精品一区二区三区在线视频| 91.麻豆视频| 亚洲国产精品综合小说图片区| www.亚洲精品| 国产精品国模大尺度视频| 国产精品系列在线播放| 精品日韩在线观看| 理论电影国产精品| 精品免费99久久| 激情文学综合插| 精品国产一二三区| 国产酒店精品激情| 国产婷婷一区二区| 成人午夜在线播放| 中文字幕一区在线观看|