-
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
Paragraph Settings for Image, Table #1437
Comments
Need that feature too. Thanks for issue! |
It would be great if it will be implemented! |
@BBalazsJurgen trick solution $wrapperTable = $section->addTable();
$row = $wrapperTable->addRow(null, ['cantSplit' => true]);
$cell = $row->addCell();
$table = $cell->addTable($this->tableStyle); Just wrap table or image you need into other "wrapper" table and that's it. |
Same for me, still waiting for this |
As Myrkotyn suggested, I was able to wrap the image in a textrun and then set the paragraph styling on the textrun.
While this works, it would be nice if:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While it might happen that we have overlooked something, I am quite certain that this might be a missing feature. If not, please point us in the right direction.
This is:
Current Behavior
You can't set paragraph options for images and tables - that is, you can't define spaceBefore, spaceAfter or keepNext for Images and Tables, as you can see in the reference:
http:https://phpword.readthedocs.io/en/latest/styles.html
Spacing and keepNext are only available for paragraphs.
How to Reproduce
Now the thing is, if you add an image using the following code:
$section->addImage(dirname(dirname(__FILE__))."/uploads/123.png", array( "spaceBefore"=>0, "spaceAfter"=>0, "width" => \PhpOffice\PhpWord\Shared\Converter::cmToPixel(12) ));
the spaceBefore, spaceAfter and keepNext (not present in the example) settings are ignored. However, it really is a frequent desire to be able to:
Expected Behavior
Now, in MS Word, you can set these paragraph options simply by clicking the image and going to paragraph settings. How can you resolve this issue without having to resort to defining keepNext in setDefaultParagraphStyle, which is much too counterintuitive. I'm open to any suggestions you have to offer. Thanks!
Context
Edit: Edited to better match the formatting requirements.
The text was updated successfully, but these errors were encountered: