We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
when setting
$paragraphStyle = [ 'alignment' => Jc::JUSTIFY, 'spaceBefore' => Converter::pointToTwip(5), 'spaceAfter' => Converter::pointToTwip(5), 'lineHeight' => 1.0 ];
alignment JUSTIFY then the word file is not opening
It should open in microsoft word also like WPS
use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; use PhpOffice\PhpWord\Shared\Converter;
$phpWord = new PhpWord();
$fontStyle = ['name' => 'Arial', 'size' => 12]; $paragraphStyle = [ 'alignment' => Jc::JUSTIFY, 'spaceBefore' => Converter::pointToTwip(5), 'spaceAfter' => Converter::pointToTwip(5), 'lineHeight' => 1.0 ]; $section = $phpWord->addSection(); $section->addText('Remember, exact vertical centering in PHPWord may vary depending on the content size and the overall cell height set. Remember, exact vertical centering in PHPWord may vary depending on the content size and the overall cell height set. ', $fontStyle, $paragraphStyle); // Force download header("Content-Description: File Transfer"); header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document'); header('Content-Disposition: attachment; filename="text_justify.docx"'); header('Cache-Control: max-age=0'); header('Pragma: public'); // Create a temporary file in the system's temporary directory $tempFile = tempnam(sys_get_temp_dir(), 'phpword'); $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007'); $objWriter->save($tempFile); // Download the file readfile($tempFile); unlink($tempFile); // Delete the temp file after downloading exit;
"phpoffice/phpword": "^1.2",
"php": "^8.1",
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug and add attachments
when setting
$paragraphStyle = [
'alignment' => Jc::JUSTIFY,
'spaceBefore' => Converter::pointToTwip(5),
'spaceAfter' => Converter::pointToTwip(5),
'lineHeight' => 1.0
];
alignment JUSTIFY then the word file is not opening
Expected behavior
It should open in microsoft word also like WPS
Steps to reproduce
use PhpOffice\PhpWord\PhpWord;
use PhpOffice\PhpWord\SimpleType\Jc;
use PhpOffice\PhpWord\Shared\Converter;
$phpWord = new PhpWord();
PHPWord version(s) where the bug happened
"phpoffice/phpword": "^1.2",
PHP version(s) where the bug happened
"php": "^8.1",
Priority
The text was updated successfully, but these errors were encountered: