public function testToAndFromString()
 {
     $this->assertTrue(count($this->listFeed->entries) == 1);
     foreach ($this->listFeed->entries as $entry) {
         $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_ListEntry);
     }
     $newListFeed = new Zend_Gdata_Spreadsheets_ListFeed();
     $doc = new DOMDocument();
     $doc->loadXML($this->listFeed->saveXML());
     $newListFeed->transferFromDom($doc->documentElement);
     $this->assertTrue(count($newListFeed->entries) == 1);
     foreach ($newListFeed->entries as $entry) {
         $this->assertTrue($entry instanceof Zend_Gdata_Spreadsheets_ListEntry);
     }
 }
 /**
  * Formats HTML to display spreadsheet content in a table
  * @param	Zend_Gdata_Feed	$feed		list feed
  * @param	string			$headers	comma-separated custom column titles to replace original titles with
  */
 public static function printStTbl(Zend_Gdata_Feed $feed, $headers = NULL)
 {
     // convert to spreadsheet list feed object
     $feed = new Zend_Gdata_Spreadsheets_ListFeed($feed->getDom());
     // if headers are specified or entries are given
     if (isset($headers) || $feed->entries[0]) {
         // start <thead>
         $html .= "\t<thead>\r\n";
         $html .= "\t\t<tr class='row_0'>\r\n\t\t\t";
         $k = 0;
         if (isset($headers)) {
             // custom headers given
             $colHeads = preg_split("/,(\\s)?/", $headers);
             // get all the headers specified by user
             foreach ($colHeads as $colHead) {
                 $colax = $k % 2 == 0 ? 'odd' : 'even';
                 $html .= "<th class='col_{$k} {$colax}'>" . $colHead . "</th>";
                 $k++;
             }
         }
         if ($feed->entries[0]) {
             // custom headers not given
             // extract column headings
             $firstRow = $feed->entries[0]->getCustom();
             // if  user did not specify all, get rest from list feed
             while ($colHead = $firstRow[$k]) {
                 $colax = $k % 2 == 0 ? 'odd' : 'even';
                 $html .= "<th class='col_{$k} {$colax}'>" . $colHead->getColumnName() . "</th>";
                 $k++;
             }
         }
         // end <thead>
         $html .= "\r\n\t\t</tr>\r\n";
         $html .= "\t</thead>\r\n";
     }
     $html .= "\t<tbody>\r\n";
     // for every row
     $i = 1;
     foreach ($feed->entries as $entry) {
         $rowlax = $i % 2 != 0 ? 'odd' : 'even';
         // start table row
         $html .= "\t\t<tr class='row_{$i} {$rowlax}'>\r\n\t\t\t";
         // get all the cells in this row
         $cells = $entry->getCustom();
         // for every cell, display the contents
         $j = 0;
         foreach ($cells as $cell) {
             $colax = $j % 2 != 0 ? 'even' : 'odd';
             $html .= "<td class='col_{$j} {$colax}'>" . $cell->getText() . "</td>";
             $j++;
         }
         // end table row
         $html .= "\r\n\t\t</tr>\r\n";
         $i++;
     }
     $html .= "\t</tbody>\r\n";
     $html .= "</table>\r\n";
     return $html;
 }