Skip to content

VERTICAL_BOTTOM alignment doesn't work for RichText Shapes. #35

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

Closed
jarredholman opened this issue Jul 10, 2014 · 5 comments
Closed

VERTICAL_BOTTOM alignment doesn't work for RichText Shapes. #35

jarredholman opened this issue Jul 10, 2014 · 5 comments

Comments

@jarredholman
Copy link

The text is always vertically aligned to the top of the box.

@Progi1984
Copy link
Member

Have you got a sample code ?

@jarredholman
Copy link
Author

something like:

$shape = $slide->createRichTextShape()->setWidth(100)->setHeight(100)
    ->setOffsetX(100)->setOffsetY(100);
$shape->createTextRun('this text should be vertically aligned');
$shape->getActiveParagraph()->getAlignment()
    ->setHorizontal(PHPPowerPoint_Style_Alignment::HORIZONTAL_LEFT);
$shape->getActiveParagraph()->getAlignment()
    ->setVertical(PHPPowerPoint_Style_Alignment::VERTICAL_BOTTOM);

This doesn't work for VERTICAL_CENTER either.

@jarredholman
Copy link
Author

Vertical alignment does seem to work for table cells, its only for text shapes that they don't.
The table writer has some extra code for dealing with vertical alignment that the text writer doesn't, perhaps that is why it works there?

https://github.com/PHPOffice/PHPPowerPoint/blob/master/Classes/PHPPowerPoint/Writer/PowerPoint2007/Slide.php#L704

$horizontalAlign = $firstParagraph->getAlignment()->getVertical();
if ($horizontalAlign != PHPPowerPoint_Style_Alignment::VERTICAL_BASE && $horizontalAlign != PHPPowerPoint_Style_Alignment::VERTICAL_AUTO) {
    $objWriter->writeAttribute('anchor', $horizontalAlign);
}

@Progi1984 Progi1984 self-assigned this Jul 11, 2014
@Progi1984 Progi1984 added this to the 0.2.0 milestone Jul 11, 2014
@jarredholman
Copy link
Author

According to https://phppowerpoint.codeplex.com/workitem/7318
The 'anchor' attribute needs to be added to the 'a:bodyPr' element.

@Progi1984
Copy link
Member

@jarredholman Fixed on the develop branch.

Progi1984 added a commit that referenced this issue Jul 21, 2014
Progi1984 added a commit that referenced this issue Jul 21, 2014
Progi1984 added a commit that referenced this issue Jul 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants