Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image alignment is not working for ODT files #869

Open
ypestis opened this issue Aug 22, 2016 · 1 comment
Open

Image alignment is not working for ODT files #869

ypestis opened this issue Aug 22, 2016 · 1 comment

Comments

@ypestis
Copy link

ypestis commented Aug 22, 2016

Hi,

I have a problem with image alignment in ODT files. I'm generating both DOCX and ODT from this code:

ODT

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addImage("images/logo.jpg",array('alignment'=> \PhpOffice\PhpWord\SimpleType\Jc::RIGHT));
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'ODText');
ob_start();
$objWriter->save("php:https://output");
$content = ob_get_clean();
Yii::$app->getResponse()->sendContentAsFile($content, 'doc.odt', [$mime,false]);

DOCX

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addImage("images/logo.jpg",array('alignment'=> \PhpOffice\PhpWord\SimpleType\Jc::RIGHT));
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
ob_start();
$objWriter->save("php:https://output");
$content = ob_get_clean();
Yii::$app->getResponse()->sendContentAsFile($content, 'doc.docx', [$mime,false]);

With DOCX its working fine, image is aligned to right, but in ODT it's still aligned to left. I tried everything and i'm out of ideas...
Anyone else had this problem? Any ideas how to solve it?

Best regards,
ypestis.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@msphn
Copy link

msphn commented Aug 24, 2016

Aligning is not actually implemented for ODT writer. I think you need to implement it yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants