PHPWord
PHPWord copied to clipboard
Add Template Merging for ODT documents
Description
Merging document is currently only supported for Word documents. This request adds features for merging also ODT templates. It adds also tests for them which pass in my local installation. TemplateProcessor.php is kept, but some of its function are migrated to TemplateProssesorCommon when they can be common to ODT ones. TemplateProcessorOdt.php is added which inherits also TemplateProssesorCommon. Functions are the same as for Word, but the class for the processor is TemplateProcessorOdt.
Checklist:
- [ X ] The new code is covered by unit tests
- [ ] I have updated the documentation to describe the changes
See also issue #952
Hello, Any hope for a review ?
Is there some news on this request?
Hello, is this version usable?
Hello, is this version usable?
I hope so. I use it for my needs. I didn't have feedback, positive or negative, as you can see.
This is exactly what I need, good job @papoteur-mga. It would be nice if it can be reviewed / merged.. @troosan @Progi1984
Supporting an open format in the TemplateProcessor would be a huge benefit. @PowerKiKi @Progi1984 could you please share whether this has ay chance to make it into core? Just so we know whether we have to copy&paste that to our own code base or if we can help to push that forward instead.
Any update on this?
Saving the generated .docx file to .odt will create an empty file.
$templateProcessor->saveAs($path); // File is ok
$phpWord = \PhpOffice\PhpWord\IOFactory::load($path);
$phpWord->save($path, 'ODText'); // File is now Blank
Even using libreoffice/soffice cli to convert ends with errors.
libreoffice --headless --convert-to odt $path
Source file could not be loaded