Table inside textbox sample

This commit is contained in:
Ivan Lanin 2014-05-10 22:04:10 +07:00
parent feff87e769
commit 9ea767ea91
2 changed files with 5 additions and 3 deletions

View File

@ -11,7 +11,7 @@ This release changed PHPWord license from LGPL 2.1 to LGPL 3.
- Image: Ability to define relative and absolute positioning - @basjan GH-217 - Image: Ability to define relative and absolute positioning - @basjan GH-217
- Footer: Conform footer with header by adding firstPage, evenPage and by inheritance - @basjan @ivanlanin GH-219 - Footer: Conform footer with header by adding firstPage, evenPage and by inheritance - @basjan @ivanlanin GH-219
- TextBox: Ability to add textbox in section, header, and footer - @basjan @ivanlanin GH-228 - TextBox: Ability to add textbox in section, header, and footer - @basjan @ivanlanin GH-228
- TextBox: Ability to add textbox in table - @basjan GH-231 - TextBox: Ability to add table inside textbox - @basjan GH-231
- HTML: Ability to add elements to PHPWord object via html - @basjan GH-231 - HTML: Ability to add elements to PHPWord object via html - @basjan GH-231
### Bugfixes ### Bugfixes

View File

@ -8,15 +8,17 @@ $phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection(); $section = $phpWord->addSection();
// In section // In section
$textbox = $section->addTextBox(array('align' => 'left', 'width' => 400, 'borderSize' => 1, 'borderColor' => '#FF0000')); $textbox = $section->addTextBox(array('align' => 'left', 'width' => 400, 'height' => 150, 'borderSize' => 1, 'borderColor' => '#FF0000'));
$textbox->addText('Text box content in section.'); $textbox->addText('Text box content in section.');
$textbox->addText('Another line.'); $textbox->addText('Another line.');
$cell = $textbox->addTable()->addRow()->addCell();
$cell->addText('Table inside textbox');
// Inside table // Inside table
$section->addTextBreak(2); $section->addTextBreak(2);
$cell = $section->addTable()->addRow()->addCell(300); $cell = $section->addTable()->addRow()->addCell(300);
$textbox = $cell->addTextBox(array('borderSize' => 1, 'borderColor' => '#0000FF', 'innerMargin' => 100)); $textbox = $cell->addTextBox(array('borderSize' => 1, 'borderColor' => '#0000FF', 'innerMargin' => 100));
$textbox->addText('Inside table'); $textbox->addText('Textbox inside table');
// Inside header with textrun // Inside header with textrun
$header = $section->addHeader(); $header = $section->addHeader();