how can i set margins when print?

Jan 22, 2009 at 11:27 AM
i need to set margins of my worksheet. the dafault is 2cm, i need 0,5cm
thanks
Developer
Jan 22, 2009 at 11:40 AM
Set margins like this:

$excel = new PHPExcel();
$sheet = $excel->getActiveSheet();
$pageMargins = $sheet->getPageMargins();

// margin is set in inches (0.5cm)
$margin = 0.5 / 2.54;

$pageMargins->setTop($margin);
$pageMargins->setBottom($margin);
$pageMargins->setLeft($margin);
$pageMargins->setRight($margin);

$writer = PHPExcel_IOFactory::createWriter($excel, 'Excel5');
$writer->save('test.xls');

Jan 22, 2009 at 11:48 AM
great, it works! thanks again