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

can't align center vertically with the text #672

Closed
ter987 opened this issue Nov 30, 2015 · 5 comments · Fixed by #1569
Closed

can't align center vertically with the text #672

ter987 opened this issue Nov 30, 2015 · 5 comments · Fixed by #1569
Assignees
Milestone

Comments

@ter987
Copy link

ter987 commented Nov 30, 2015

I used phpword plugin to create word files in my project ,but I have a problem that the paragraph didn't align center ,for example :
11

But I want like this :
22

My codes:
$textrun = $section->createTextRun(array('widowControl'=>'true'));
$textrun->addText('There is a',array('size'=>13));
$textrun->addImage('563803062838d1446511366.gif');
$textrun->addText('whick is a',array('size'=>13));


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

@DannydeJong
Copy link

Is the image itself not too high?

EDIT: I mean, as in it not fitting exactly around the text and including white (or invisible) pixels at the bottom of the image.

@ter987
Copy link
Author

ter987 commented Dec 16, 2015

center-text-vertically-word-2013-4

I mean,the word 2010 have a function that can align center vertically ,like the image , and does phpword have this function ?

@darkf3d3
Copy link

I'm interested into this too. Actually phpword support this?

@troosan
Copy link
Contributor

troosan commented Jan 24, 2019

indeed, this does not seem to be implemented.
http://www.datypic.com/sc/ooxml/e-w_vAlign-1.html
Need to write the following in PhpOffice\PhpWord\Writer\Word2007\Style\Section

<w:sectPr>
<w:vAlign w:val="center"/>
</w:sectPr>

@troosan troosan closed this as completed Jan 24, 2019
@troosan troosan reopened this Jan 24, 2019
@troosan troosan self-assigned this Jan 24, 2019
@troosan troosan added this to the v0.17.0 milestone Jan 24, 2019
@xcephpdev
Copy link

Hi,

How we we add this in the Section.php File
<w:sectPr>
<w:vAlign w:val="center"/>
</w:sectPr>

THIS IS FROM THE FILES:
// Page size & orientation
$xmlWriter->startElement('w:pgSz');
$xmlWriter->writeAttribute('w:orient', $style->getOrientation());
$xmlWriter->writeAttribute('w:w', $style->getPageSizeW());
$xmlWriter->writeAttribute('w:h', $style->getPageSizeH());
$xmlWriter->endElement(); // w:pgSz

And which tag will be used to set the value dynamically.

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

Successfully merging a pull request may close this issue.

5 participants