You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1010 B
41 lines
1010 B
<?php
|
|
|
|
namespace App\Parser\DocxParser\Table;
|
|
|
|
use App\Parser\DocxParser\Traits\Helper;
|
|
use Exception;
|
|
use Illuminate\Support\Arr;
|
|
use PhpOffice\PhpWord\Element\TextBreak;
|
|
|
|
class Cell
|
|
{
|
|
|
|
use Helper;
|
|
|
|
public function handle($cell)
|
|
{
|
|
$result = [];
|
|
$cells = $this->getElements($cell);
|
|
foreach ($this->getElements($cell) as $index => $element) {
|
|
if (! $element instanceof TextBreak) {
|
|
try {
|
|
$handler = $this->getHandler($element);
|
|
} catch (Exception $e) {
|
|
throw new Exception($e->getMessage());
|
|
}
|
|
$data = $handler->handle($element);
|
|
$data['width']= $cell->getWidth();
|
|
$result[] = $data;
|
|
}
|
|
|
|
}
|
|
|
|
return [
|
|
'content' => '',
|
|
'children' => $result,
|
|
'depth' => null,
|
|
'type' => 'cell',
|
|
];
|
|
|
|
}
|
|
}
|