Merge branch 'master' of https://github.com/gianis6/PHPWord into gianis6-master
This commit is contained in:
commit
160c2c7922
@ -555,6 +555,30 @@ class Base extends WriterPart
|
|||||||
|
|
||||||
if ($_cRows > 0) {
|
if ($_cRows > 0) {
|
||||||
$xmlWriter->startElement('w:tbl');
|
$xmlWriter->startElement('w:tbl');
|
||||||
|
|
||||||
|
// Table grid
|
||||||
|
$cellWidths = array();
|
||||||
|
for ($i = 0; $i < $_cRows; $i++) {
|
||||||
|
$row = $_rows[$i];
|
||||||
|
$cells = $row->getCells();
|
||||||
|
if (count($cells) <= count($cellWidths)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$cellWidths = array();
|
||||||
|
foreach ($cells as $cell) {
|
||||||
|
$cellWidths[] = $cell->getWidth();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$xmlWriter->startElement('w:tblGrid');
|
||||||
|
foreach ($cellWidths as $width) {
|
||||||
|
$xmlWriter->startElement('w:gridCol');
|
||||||
|
$xmlWriter->writeAttribute('w:w', $width);
|
||||||
|
$xmlWriter->writeAttribute('w:type', 'dxa');
|
||||||
|
$xmlWriter->endElement();
|
||||||
|
}
|
||||||
|
$xmlWriter->endElement(); // w:tblGrid
|
||||||
|
|
||||||
|
// Table style
|
||||||
$tblStyle = $table->getStyle();
|
$tblStyle = $table->getStyle();
|
||||||
$tblWidth = $table->getWidth();
|
$tblWidth = $table->getWidth();
|
||||||
if ($tblStyle instanceof PhpOffice\PhpWord\Style\Table) {
|
if ($tblStyle instanceof PhpOffice\PhpWord\Style\Table) {
|
||||||
@ -575,6 +599,7 @@ class Base extends WriterPart
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Table rows
|
||||||
for ($i = 0; $i < $_cRows; $i++) {
|
for ($i = 0; $i < $_cRows; $i++) {
|
||||||
$row = $_rows[$i];
|
$row = $_rows[$i];
|
||||||
$height = $row->getHeight();
|
$height = $row->getHeight();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user