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

Add table in section aligned as center #237

Closed
ozilion opened this issue May 12, 2014 · 5 comments
Closed

Add table in section aligned as center #237

ozilion opened this issue May 12, 2014 · 5 comments

Comments

@ozilion
Copy link
Contributor

ozilion commented May 12, 2014

How to align table as centered in section. I need to add a new table with 3 row 1 column and has half width of page or section but placed at center in horizontal. When document created the final result should be like in image below.

image

@ivanlanin ivanlanin added this to the 0.11.0 milestone May 12, 2014
@ivanlanin ivanlanin self-assigned this May 12, 2014
ivanlanin added a commit to ivanlanin/PHPWord that referenced this issue May 12, 2014
@ivanlanin
Copy link
Contributor

Hi @ozilion. Use the width, unit, and align style of the table element from the latest develop branch like below:

$table = $section->addTable(array('width' => 50 * 50, 'unit' => 'pct', 'align' => 'center'));

The value for width is in fiftieths (1/50) of a percent when you use "pct" for unit or in twips if you use "dxa" for unit. The value for align is "left", "right", or "center".

See the last table in Sample_09_Tables.php for sample and tell us if you still have any problem. Thanks.

@ozilion
Copy link
Contributor Author

ozilion commented May 13, 2014

Thanks ivanlanin, I'll try during day just I have a time and back here for result.

@ozilion
Copy link
Contributor Author

ozilion commented May 13, 2014

Hi, using latest develop branch i can create word document int Word2007 docx format is successful just as I expected.

@ivanlanin
Copy link
Contributor

Ok. So the table width & position issue was solved and this is a new issue?

@ozilion
Copy link
Contributor Author

ozilion commented May 14, 2014

Yes and i am opening new issue for new situation. Thanks for reminding.

@ozilion ozilion closed this as completed May 14, 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

3 participants