Skip to content

Commit

Permalink
Placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
ordinaryparksee committed Oct 12, 2020
1 parent 5418f07 commit b3325e8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vaxy/table-to-excel",
"version": "0.1.3",
"version": "0.1.4",
"description": "Convert HTML Table to phpspreadsheet",
"authors": [
{
Expand Down
2 changes: 1 addition & 1 deletion samples/sample.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</thead>
<tbody>
<tr>
<td style="font-weight: bold; color: #ff0000;">cell1</td>
<td style="font-weight: bold; color: #ff0000;">{{$cell->getRow() + 1}}</td>
<td width="100" style="text-align: right;">cell2</td>
</tr>
<tr>
Expand Down
4 changes: 3 additions & 1 deletion src/TableToExcel/TableParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ public static function parse($source)
}
}
$cell = $sheet->getCellByColumnAndRow($columnIndex + $rowspanStep, $rowIndex);
$cell->setValue($td->textContent);
$cell->setValue(preg_replace_callback('/\{\{([^}]+)\}\}/', function($_) use ($cell) {
return eval('return '.$_[1].';');
}, $td->textContent));
$style = $cell->getStyle();
$style->getAlignment()->setVertical('center');
$pre = $td->getElementsByTagName('pre');
Expand Down

0 comments on commit b3325e8

Please sign in to comment.