fix broken samples
This commit is contained in:
parent
54e7c6dd5a
commit
b375b8580f
|
|
@ -7,13 +7,8 @@ $source = "resources/{$name}.doc";
|
|||
echo date('H:i:s'), " Reading contents from `{$source}`", EOL;
|
||||
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source, 'MsDoc');
|
||||
|
||||
// (Re)write contents
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
// Save file
|
||||
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
||||
if (!CLI) {
|
||||
include_once 'Sample_Footer.php';
|
||||
}
|
||||
|
||||
include_once 'Sample_Footer.php';
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ $templateProcessor->deleteBlock('DELETEME');
|
|||
echo date('H:i:s'), ' Saving the result document...', EOL;
|
||||
$templateProcessor->saveAs('results/Sample_23_TemplateBlock.docx');
|
||||
|
||||
echo getEndingNotes(array('Word2007' => 'docx'), 'results/Sample_23_TemplateBlock.docx');
|
||||
echo getEndingNotes(array('Word2007' => 'docx'), 'Sample_23_TemplateBlock');
|
||||
if (!CLI) {
|
||||
include_once 'Sample_Footer.php';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@
|
|||
<h2>Includes images</h2>
|
||||
<img src="https://phpword.readthedocs.io/en/latest/_images/phpword.png" alt=""/>
|
||||
|
||||
<img src="https://localhost/gev/desarrollo/actividades/pruebas_14/5b064503587f7.jpeg" name="Imagen 12" align="bottom" width="208" height="183" border="0"/>
|
||||
<img src="http://localhost/gev/desarrollo/actividades/pruebas_14/5b064503589db.png" name="Imagen 13" align="bottom" width="143" height="202" border="0"/>
|
||||
<img src="http://localhost/gev/desarrollo/actividades/pruebas_14/5b0645035aac8.jpeg" name="Imagen 14" align="bottom" width="194" height="188" border="0"/>
|
||||
<img src="http://php.net/images/logos/php-med-trans-light.gif" name="Imagen 12" align="bottom" width="208" height="183" border="0"/>
|
||||
<img src="http://php.net/images/logos/php-icon.png" name="Imagen 13" align="bottom" width="143" height="202" border="0"/>
|
||||
<img src="http://php.net/images/logos/php-med-trans-light.gif" name="Imagen 14" align="bottom" width="194" height="188" border="0"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -107,20 +107,24 @@ class Table extends AbstractElement
|
|||
/**
|
||||
* Translates Table style in CSS equivalent
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Style\Table|null $tableStyle
|
||||
* @param string|\PhpOffice\PhpWord\Style\Table|null $tableStyle
|
||||
* @return string
|
||||
*/
|
||||
private function getTableStyle(\PhpOffice\PhpWord\Style\Table $tableStyle = null)
|
||||
private function getTableStyle($tableStyle = null)
|
||||
{
|
||||
if ($tableStyle == null) {
|
||||
return '';
|
||||
}
|
||||
if (is_string($tableStyle)) {
|
||||
$style = ' class="' . $tableStyle;
|
||||
} else {
|
||||
$style = ' style="';
|
||||
if ($tableStyle->getLayout() == \PhpOffice\PhpWord\Style\Table::LAYOUT_FIXED) {
|
||||
$style .= 'table-layout: fixed;';
|
||||
} elseif ($tableStyle->getLayout() == \PhpOffice\PhpWord\Style\Table::LAYOUT_AUTO) {
|
||||
$style .= 'table-layout: auto;';
|
||||
}
|
||||
}
|
||||
|
||||
return $style . '"';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue