package izyndoc;

import com.jacob.com.*;

/**
 * <p>Title: ExcelWorksheet</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author Richard Norton
 * @version 1.0
 */

public class ExcelWorksheet extends com.jacob.com.Dispatch
{
  /**
   * Constructor.
   */
  public ExcelWorksheet()
  {
    super("Excel.Worksheet");
  }

  /**
   * Alternative constructor to be used if you need to return a ExcelWorksheet
   * object from another object's method call.
   *
   * @param dispatchSheet Dispatch
   */
  public ExcelWorksheet(Dispatch dispatchWorksheet)
  {
    //TAKE OVER THE IDispatch POINTER
    this.m_pDispatch = dispatchWorksheet.m_pDispatch;
    //NULL OUT THE INPUT POINTER
    dispatchWorksheet.m_pDispatch = 0;
  }

//  /**
//   * Set 'saved' to false so Word thinks doc is 'dirty'
//   * otherwise it fails to save added custom properties
//   * found in MS knowledge base article - 195425
//   */
//  public void dirtyDoc()
//  {
//    Dispatch.put(this, "Saved", new Variant(Word.FALSE));
//  }

  /**
   * Get the Range object for the cells
   *
   * @return Dispatch
   */
  public Dispatch getRange(Object[] theCells)
  {
    return Dispatch.callN(this, "Range", theCells).toDispatch();
  }

  /**
   * Get the Range object for a cell
   *
   * @return Dispatch
   */
  public Dispatch getCellRange(String aCell)
  {
    Object[] theCell = {aCell};
    return Dispatch.callN(this, "Range", theCell).toDispatch();
  }

  /**
   * Returns an object that represents the active sheet (the sheet on top)
   * in the active workbook or in the specified window or workbook.
   *
   * @return Dispatch
   */
  public Dispatch getActiveSheet()
  {
    return Dispatch.get(this, "ActiveSheet").toDispatch();
  }

//  /**
//   * Save the document.
//   *
//   * @param fileName String
//   */
//  public void saveAs(String fileName)
//  {
//    Dispatch.call(this, "SaveAs", fileName);
//  }
}
