/** * @param null|int $index */ public function start($index = null) { if ($this->sheetWrapper->getObject() === null) { throw new \LogicException(); } if ($index !== null && !is_int($index)) { throw new \InvalidArgumentException(); } if ($index === null) { $this->sheetWrapper->increaseRow(); } else { $this->sheetWrapper->setRow($index); } }
/** * @param string $type * @param null|array $properties */ public function start($type, array $properties = null) { if ($this->sheetWrapper->getObject() === null) { throw new \LogicException(); } if (in_array(strtolower($type), ['header', 'oddheader', 'evenheader', 'firstheader', 'footer', 'oddfooter', 'evenfooter', 'firstfooter'], true) === false) { throw new \InvalidArgumentException(); } $this->object = $this->sheetWrapper->getObject()->getHeaderFooter(); $this->attributes['value'] = ['left' => null, 'center' => null, 'right' => null]; // will be generated by the alignment tags $this->attributes['type'] = $type; $this->attributes['properties'] = $properties ?: []; if ($properties !== null) { $this->setProperties($properties, $this->mappings); } }
/** * @param string $path * @param array $properties * * @throws \PHPExcel_Exception */ public function start($path, array $properties = null) { if ($this->sheetWrapper->getObject() === null) { throw new \LogicException(); } // create local copy of the asset $tempPath = $this->createTempCopy($path); // add to header/footer if ($this->headerFooterWrapper->getObject()) { $headerFooterAttributes = $this->headerFooterWrapper->getAttributes(); $location = ''; switch (strtolower($this->headerFooterWrapper->getAlignmentAttributes()['type'])) { case 'left': $location .= 'L'; $headerFooterAttributes['value']['left'] .= '&G'; break; case 'center': $location .= 'C'; $headerFooterAttributes['value']['center'] .= '&G'; break; case 'right': $location .= 'R'; $headerFooterAttributes['value']['right'] .= '&G'; break; default: throw new \InvalidArgumentException(); } switch (strtolower($headerFooterAttributes['type'])) { case 'header': case 'oddheader': case 'evenheader': case 'firstheader': $location .= 'H'; break; case 'footer': case 'oddfooter': case 'evenfooter': case 'firstfooter': $location .= 'F'; break; default: throw new \InvalidArgumentException(); } $this->object = new \PHPExcel_Worksheet_HeaderFooterDrawing(); $this->object->setPath($tempPath); $this->headerFooterWrapper->getObject()->addImage($this->object, $location); $this->headerFooterWrapper->setAttributes($headerFooterAttributes); } else { $this->object = new \PHPExcel_Worksheet_Drawing(); $this->object->setWorksheet($this->sheetWrapper->getObject()); $this->object->setPath($tempPath); } if ($properties !== null) { $this->setProperties($properties, $this->mappings); } }
/** * @param null|int $index * @param null|mixed $value * @param null|array $properties * * @throws \PHPExcel_Exception */ public function start($index = null, $value = null, array $properties = null) { if ($this->sheetWrapper->getObject() === null) { throw new \LogicException(); } if ($index !== null && !is_int($index)) { throw new \InvalidArgumentException(); } if ($index === null) { $this->sheetWrapper->increaseColumn(); } else { $this->sheetWrapper->setColumn($index); } $this->object = $this->sheetWrapper->getObject()->getCellByColumnAndRow($this->sheetWrapper->getColumn(), $this->sheetWrapper->getRow()); if ($value !== null) { $this->object->setValue($value); } if ($properties !== null) { $this->setProperties($properties, $this->mappings); } $this->attributes['value'] = $value; $this->attributes['properties'] = $properties ?: []; }