PHPWord icon indicating copy to clipboard operation
PHPWord copied to clipboard

Add Template Merging for ODT documents

Open papoteur-mga opened this issue 4 years ago • 5 comments

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

papoteur-mga avatar Mar 08 '21 20:03 papoteur-mga

See also issue #952

papoteur-mga avatar Mar 09 '21 08:03 papoteur-mga

Hello, Any hope for a review ?

papoteur-mga avatar Mar 18 '21 09:03 papoteur-mga

Is there some news on this request?

papoteur-mga avatar Oct 01 '21 09:10 papoteur-mga

Hello, is this version usable?

TBBH2I avatar Sep 19 '22 08:09 TBBH2I

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.

papoteur-mga avatar Sep 19 '22 08:09 papoteur-mga

This is exactly what I need, good job @papoteur-mga. It would be nice if it can be reviewed / merged.. @troosan @Progi1984

efontainx avatar Oct 14 '22 09:10 efontainx

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.

kevinpapst avatar Dec 17 '22 20:12 kevinpapst

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

cavasinf avatar Jun 27 '23 07:06 cavasinf