PHPExcel_Worksheet PHP Class Code Examples

This page contains top rated real world PHP examples of class PHPExcel_Worksheet extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: CacheBase.php Project: hcvcastro/pxp
0
 /**
  *	Clone the cell collection
  *
  *	@return	void
  */
 public function copyCellCollection(PHPExcel_Worksheet $parent)
 {
     $this->_parent = $parent;
     if (!is_null($this->_currentObject) && is_object($this->_currentObject)) {
         $this->_currentObject->attach($parent);
     }
 }
Example #2
Show file File: Content.php Project: MyPHPTools/PHPExcel
0
 /**
  * Write rows of the specified sheet
  *
  * @param PHPExcel_Shared_XMLWriter $objWriter
  * @param PHPExcel_Worksheet $sheet
  */
 private function _writeRows(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Worksheet $sheet)
 {
     $number_rows_repeated = self::NUMBER_ROWS_REPEATED_MAX;
     $span_row = 0;
     $rows = $sheet->getRowIterator();
     while ($rows->valid()) {
         $number_rows_repeated--;
         $row = $rows->current();
         if ($row->getCellIterator()->valid()) {
             if ($span_row) {
                 $objWriter->startElement('table:table-row');
                 if ($span_row > 1) {
                     $objWriter->writeAttribute('table:number-rows-repeated', $span_row);
                 }
                 $objWriter->startElement('table:table-cell');
                 $objWriter->writeAttribute('table:number-columns-repeated', self::NUMBER_COLS_REPEATED_MAX);
                 $objWriter->endElement();
                 $objWriter->endElement();
                 $span_row = 0;
             }
             $objWriter->startElement('table:table-row');
             $this->_writeCells($objWriter, $row);
             $objWriter->endElement();
         } else {
             $span_row++;
         }
         $rows->next();
     }
 }
Example #3
Show file File: CacheBase.php Project: gg1122/Dswjcms
0
 /**
  * Clone the cell collection
  *
  * @param	PHPExcel_Worksheet	$parent		The new worksheet
  * @return	void
  */
 public function copyCellCollection(PHPExcel_Worksheet $parent)
 {
     $this->_parent = $parent;
     if ($this->_currentObject !== NULL && is_object($this->_currentObject)) {
         $this->_currentObject->attach($parent);
     }
 }
Example #4
Show file File: Rels.php Project: hostellerie/nexpro
0
 /**
  * Write drawing relationships to XML format
  *
  * @param 	PHPExcel_Worksheet			$pWorksheet
  * @return 	string 						XML Output
  * @throws 	Exception
  */
 public function writeDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null)
 {
     // Create XML writer
     $objWriter = null;
     if ($this->getParentWriter()->getUseDiskCaching()) {
         $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK);
     } else {
         $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
     }
     // XML header
     $objWriter->startDocument('1.0', 'UTF-8', 'yes');
     // Relationships
     $objWriter->startElement('Relationships');
     $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
     // Loop trough images and write relationships
     $i = 1;
     $iterator = $pWorksheet->getDrawingCollection()->getIterator();
     while ($iterator->valid()) {
         if ($iterator->current() instanceof PHPExcel_Worksheet_Drawing) {
             // Write relationship for image drawing
             $this->_writeRelationship($objWriter, $i, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . $iterator->current()->getFilename());
         }
         $iterator->next();
         $i++;
     }
     $objWriter->endElement();
     // Return
     return $objWriter->getData();
 }
Example #5
Show file File: BaseDrawing.php Project: agashish/test_new
0
 /**
  * Set Worksheet
  *
  * @param 	PHPExcel_Worksheet 	$pValue
  * @param 	bool				$pOverrideOld	If a Worksheet has already been assigned, overwrite it and remove image from old Worksheet?
  * @throws 	PHPExcel_Exception
  * @return PHPExcel_Worksheet_BaseDrawing
  */
 public function setWorksheet(PHPExcel_Worksheet $pValue = null, $pOverrideOld = false)
 {
     if (is_null($this->_worksheet)) {
         // Add drawing to PHPExcel_Worksheet
         $this->_worksheet = $pValue;
         $this->_worksheet->getCell($this->_coordinates);
         $this->_worksheet->getDrawingCollection()->append($this);
     } else {
         if ($pOverrideOld) {
             // Remove drawing from old PHPExcel_Worksheet
             $iterator = $this->_worksheet->getDrawingCollection()->getIterator();
             while ($iterator->valid()) {
                 if ($iterator->current()->getHashCode() == $this->getHashCode()) {
                     $this->_worksheet->getDrawingCollection()->offsetUnset($iterator->key());
                     $this->_worksheet = null;
                     break;
                 }
             }
             // Set new PHPExcel_Worksheet
             $this->setWorksheet($pValue);
         } else {
             throw new PHPExcel_Exception("A PHPExcel_Worksheet has already been assigned. Drawings can only exist on one PHPExcel_Worksheet.");
         }
     }
     return $this;
 }
Example #6
Show file File: RowIterator.php Project: ahmatjan/OpenCart-Overclocked
0
 /**
  * Create a new row iterator
  *
  * @param	PHPExcel_Worksheet	$subject	The worksheet to iterate over
  * @param	integer				$startRow	The row number at which to start iterating
  * @param	integer				$endRow	    Optionally, the row number at which to stop iterating
  */
 public function __construct(PHPExcel_Worksheet $subject = null, $startRow = 1, $endRow = null)
 {
     // Set subject
     $this->_subject = $subject;
     $this->resetEnd($endRow);
     $this->resetStart($startRow);
 }
Example #7
Show file File: ColumnIterator.php Project: rostrowicki/PHPExcel
0
 /**
  * Create a new column iterator
  *
  * @param	PHPExcel_Worksheet	$subject	The worksheet to iterate over
  * @param	string				$startColumn	The column address at which to start iterating
  * @param	string				$endColumn	    Optionally, the column address at which to stop iterating
  */
 public function __construct(PHPExcel_Worksheet $subject = null, $startColumn = 'A', $endColumn = null)
 {
     // Set subject
     $this->_subject = $subject;
     $this->resetEnd($endColumn);
     $this->resetStart($startColumn);
 }
Example #8
Show file File: Chart.php Project: JaeHoYun/generatedata
0
 /**
  * Write Bubble Chart Details
  *
  * @param	PHPExcel_Chart_DataSeriesValues		$plotSeriesValues
  * @param 	PHPExcel_Shared_XMLWriter 			$objWriter 			XML Writer
  * @throws 	Exception
  */
 private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet)
 {
     if (is_null($plotSeriesValues)) {
         return;
     }
     $objWriter->startElement('c:bubbleSize');
     $objWriter->startElement('c:numLit');
     $objWriter->startElement('c:formatCode');
     $objWriter->writeRawData('General');
     $objWriter->endElement();
     $objWriter->startElement('c:ptCount');
     $objWriter->writeAttribute('val', $plotSeriesValues->getPointCount());
     $objWriter->endElement();
     $dataValues = $plotSeriesValues->getDataValues();
     if (!empty($dataValues)) {
         if (is_array($dataValues)) {
             foreach ($dataValues as $plotSeriesKey => $plotSeriesValue) {
                 $objWriter->startElement('c:pt');
                 $objWriter->writeAttribute('idx', $plotSeriesKey);
                 $objWriter->startElement('c:v');
                 $objWriter->writeRawData(1);
                 $objWriter->endElement();
                 $objWriter->endElement();
             }
         }
     }
     $objWriter->endElement();
     $objWriter->endElement();
     $objWriter->startElement('c:bubble3D');
     $objWriter->writeAttribute('val', 0);
     $objWriter->endElement();
 }
Example #9
Show file File: CacheBase.php Project: hoanglannet/copar
0
 public function __construct(PHPExcel_Worksheet $parent)
 {
     //	Set our parent worksheet.
     //	This is maintained within the cache controller to facilitate re-attaching it to PHPExcel_Cell objects when
     //		they are woken from a serialized state
     $this->_parent = $parent;
 }