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

paperSize and margins are broken in ODT #1531

Open
1 task done
skylarmt opened this issue Dec 9, 2018 · 1 comment
Open
1 task done

paperSize and margins are broken in ODT #1531

skylarmt opened this issue Dec 9, 2018 · 1 comment

Comments

@skylarmt
Copy link

skylarmt commented Dec 9, 2018

This is:

  • a bug report

Expected Behavior

$phpWord->addSection(["paperSize" => "Letter", 'marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600]); should produce a file with Letter-sized paper and "skinny" margins.

Current Behavior

Saving files in Word format has the expected result; however, the paper size and margin settings are ignored when saving in ODT format. The resulting document is A4 sized with 0.98 inch margins (0.79 inch bottom margin).

How to Reproduce

<?php
require __DIR__ . '/vendor/autoload.php';

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection(["paperSize" => "Letter"]);
$section->addText("Hello world");
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'ODText');
$objWriter->save('file.odt'); // Will have A4 page size

$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('file.docx'); // Will have Letter page size

Context

  • PHP version: 7.2.10
  • PHPWord version: 0.14
@skylarmt
Copy link
Author

skylarmt commented Dec 10, 2018

If someone fixes this before January, I'll send them $10 (US). This has the potential to delay a project I'm developing for a client.

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

1 participant