protected function buildBody(VendingMachine $vendingMachine) { $this->phpExcelObject->getActiveSheet()->setCellValueByColumnAndRow(1, 8, "№ п/п")->setCellValueByColumnAndRow(2, 8, "Категория")->setCellValueByColumnAndRow(5, 8, "Артикул")->setCellValueByColumnAndRow(6, 8, "Наименование")->setCellValueByColumnAndRow(9, 8, "Количество"); $this->phpExcelObject->getActiveSheet()->mergeCells($this->getPosition(8, 8, 'C') . ":" . $this->getPosition(8, 8, 'E'))->mergeCells($this->getPosition(8, 8, 'G') . ":" . $this->getPosition(8, 8, 'I')); $this->styleAlignHorizontalCenter(8, 8)->styleBorderThick(8, 8)->styleFontBold(8, 8); $currentRow = 9; foreach ($vendingMachine->getPurchases() as $purchase) { $currentRow++; $currentPurchase = $purchase['object']; $this->phpExcelObject->getActiveSheet()->setCellValueByColumnAndRow(1, $currentRow, $currentPurchase->getProduct()->getId())->setCellValueByColumnAndRow(2, $currentRow, $currentPurchase->getProduct()->getProductCategory()->getName())->setCellValueByColumnAndRow(5, $currentRow, $currentPurchase->getProduct()->getCode())->setCellValueByColumnAndRow(6, $currentRow, $currentPurchase->getProduct()->getNameFull())->setCellValueByColumnAndRow(9, $currentRow, $purchase['quantity']); $this->phpExcelObject->getActiveSheet()->mergeCells($this->getPosition($currentRow, $currentRow, 'C') . ":" . $this->getPosition($currentRow, $currentRow, 'E'))->mergeCells($this->getPosition($currentRow, $currentRow, 'G') . ":" . $this->getPosition($currentRow, $currentRow, 'I')); $this->styleBorderThin($currentRow, $currentRow); } }