What is the correct syntax of using page size command

Feb 12, 2011 at 5:58 AM
Edited Feb 12, 2011 at 6:06 AM

Hello,

 

I am trying to use pageSizeW command to set the size of my word document.I am getting the error.Any anyone plz tell whats is the correct way to declare it,

I have done something as below

$section = $PHPWord->createSection();

$sectionStyle = $section->getSettings();

$sectionStyle->setPageSizeW();

 

Feb 13, 2011 at 3:06 PM

This works for me. I needed to print a small card. Units of measure are in twips.

$section = $PHPWord->createSection(
  array( 'marginLeft'=>210, 'marginRight'=>200, 'marginTop'=>620, 'marginBottom'=>0, 'pageSizeW'=>3038.4, 'pageSizeH'=>4847.04));

Aug 10, 2014 at 7:32 AM
Good jillelaine, it works fine. But that size in milimeter, pixel or others? and how about set to general size such as F4, A4 etc?
Aug 10, 2014 at 2:53 PM
"Twip" is a unit of measurement equal to 1/20th of a printers point. There are 1440 twips to and inch, 567 twips to a centimeter. http://support.microsoft.com/kb/76388

You should also check out the phpWord development on github:

They have added the ability to use measurement unit other than twips with setMeasurementUnit, thanks to ivanlanin, and many other features and bugfixes. https://github.com/PHPOffice/PHPWord/