OpenDocumentPHP
[ class tree: OpenDocumentPHP ] [ index: OpenDocumentPHP ] [ all elements ]

Source for file OpenDocumentSpreadsheet.php

Documentation is available at OpenDocumentSpreadsheet.php

  1. <?php
  2. /*
  3.  * Created on 04.01.2007 by Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
  4.  *
  5.  * PHP versions 5.2 or better.
  6.  *
  7.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  8.  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  9.  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  10.  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  11.  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  12.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  13.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  14.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  15.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  16.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  17.  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  18.  *
  19.  * This software consists of voluntary contributions made by many individuals
  20.  * and is licensed under the GPL. For more information please see
  21.  * <http://opendocumentphp.org>.
  22.  * 
  23.  * $Id: OpenDocumentSpreadsheet.php 182 2007-06-11 13:32:34Z nmarkgraf $
  24.  */
  25. require_once 'OpenDocumentPHP/OpenDocumentAbstract.php';
  26. /**
  27.  * 
  28.  * 
  29.  * @author         Norman Markgraf (nmarkgraf(at)user.sourceforge.net)
  30.  * @copyright     Copyright in 2006, 2007 by The OpenDocumentPHP Team
  31.  * @license     http://www.gnu.org/licenses/gpl.html GNU Public License 2.0 or above.
  32.  * @version        $Revision: 182 $
  33.  * @package        OpenDocumentPHP
  34.  * @since         0.5.0 - 08.02.2007
  35.  */
  36.     /**
  37.     * 
  38.     */
  39.     const odmCalcNamespace = 'application/vnd.oasis.opendocument.spreadsheet';
  40.     /**
  41.      * Constructor method.
  42.      * 
  43.      * @param         string fullpath Full path and name of the document
  44.      * @since         0.5.0 - 08.02.2007
  45.      */
  46.     function __construct($fullpath=null{
  47.         // Construct a text document
  48.         parent :: __construct(self :: odmCalcNamespace);
  49.         // Is the variable $fullpath given?
  50.         if (isset($fullpath&& is_string($fullpath)) {            
  51.             if (file_exists($fullpath)) {
  52.                 // File does exist, so we can load it via open.
  53.                 parent :: open($fullpath);
  54.             else {
  55.                 // File does not exist, so we can create it.        
  56.                 parent :: open($fullpathself :: CREATEself :: odmCalcNamespace);
  57.                 // Clean it, with a fresh init call.                
  58.                 $this->init();                
  59.                 // Set everything to a OpenDocument TEXT file.
  60.                 $this->content->setSpreadsheet();
  61.             }
  62.         else {
  63.             // JUST A CLEAN FILE WITH NO FILE NAME JET!!!! DANGER!!!!
  64.             $this->init();
  65.             $this->content->setSpreadsheet();
  66.         }
  67.     }
  68.     /**
  69.      * Create a new sheet with the name '$sheetname'.
  70.      * 
  71.      * @access         public
  72.      * @param          string sheetname The name of the new sheet
  73.      * @return         object 
  74.      * @access         public
  75.      * @since         0.5.0 - 08.02.2007
  76.      */
  77.     function addSheet($sheetname{
  78.         return $this->content->getTable($sheetname);
  79.     }
  80. }
  81. ?>

Documentation generated on Tue, 12 Jun 2007 10:00:29 +0200 by phpDocumentor 1.3.2