-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Cannot align text #834
Comments
use |
Thanks! However, it does not work for ODText format, only for Word2007 (I use LibreOffice 5). |
$table->addCell(6500)->addText("Text", [], ['align' => \PhpOffice\PhpWord\Style\Cell::VALIGN_CENTER ]); |
Currently I am Struggling for alignment in phpword (0.14.0) .I am Not able to do perform align left,right, center. But for alignment Justify i am using this code it's working for me $phpWord->setDefaultParagraphStyle( i want to know alignment ( left,right, center ) . code If anybody knows please let me know |
Hi @troosan, How can I valign text in a cell? Below methods seems not to work, only I can center it horizontally but not vertically: $fancyTableCellStyle = array('valign' => 'center');
$fancyTableFontStyle = array('bold' => true, 'color' => 'FFFFFF');
$tableCenterValignText = array('alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER, 'align' => \PhpOffice\PhpWord\Style\Cell::VALIGN_CENTER);
$table->addCell(3000, $fancyTableCellStyle)->addText('Acct Name', $fancyTableFontStyle, $tableCenterValignText) Regards! |
@mcabanatan please check Sample_09_Tables.php, there's an example there |
HI @troosan, My above code came from Sample_09_Tables.php which doesnt work. I'm opening the word in word2013. Any chance you can try it on your end? Regards |
Well that works perfect! I don't know why it doesn't work on mine(word2013). Can I have the code you use to generate the word file? Thanks in advance! |
@mcabanatan That's exactly from Sample_09_Tables.php |
@mcabanatan set space in $tableCenterValignText
|
$section->addText('Centered', array('bold' => true), array('align' => 'center')); |
$section->addText("Center", array('bold' => true, "size"=>25), array('align' => 'center')); |
Hi,
I'm using PHPWord 12.1 but I don't manage to align text. The following code generates bold text but aligned to the left:
Thanks
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: