Browse Source

new feature: reader can return only a specific named range, typically a worksheet

Frederic G. Marand 16 years ago
parent
commit
be0f4b0fd8
1 changed files with 6 additions and 3 deletions
  1. 6 3
      ooo/Calc_Reader.php

+ 6 - 3
ooo/Calc_Reader.php

@@ -4,7 +4,7 @@
  *
  * Requires PHP 5.2
  *
- * @version $Id: Calc_Reader.php,v 1.2 2007-08-06 06:17:06 marand Exp $
+ * @version $Id: Calc_Reader.php,v 1.3 2007-08-06 16:32:48 marand Exp $
  * @license CeCILL 2.0
  * @copyright 2005-2006 Ouest Systemes Informatiques
  */
@@ -44,11 +44,14 @@ class Calc_Reader
    * Return the rows in the spreadsheet as a DOMNodeList
    * WARNING: this means ALL the rows, in all the sheets, not just the first sheet
    *
+   * @param string $namedRange Optional name of range, notably Sheet name
    * @return DOMNodeList
    */
-  function getRows ()
+  function getRows ($namedRange = NULL)
     {
-    $query = '//table:table-row';
+    $query = empty($namedRange) 
+      ? '//table:table-row'
+      : '//table:table[@table:name="' . $namedRange . '"]/table:table-row';
 
     $ret = $this->xpath->query($query);
     unset($query);