<?php

$dir = dirname(__FILE__);
require_once($dir."/../shared/PHPRtfLite/lib/PHPRtfLite.php");
PHPRtfLite::registerAutoloader();
$rtf = new PHPRtfLite();

// margins: left 1cm, top 3cm, right 2cm, bottom 4cm
$rtf->setMargins(1, 3, 2, 4);

$sect = $rtf->addSection();

$table = $sect->addTable();

//$table->addRow(0.3);
//$table->addRows($rowCount, $rowHeight);
$table->addRows(4, 0.3);
// add 3 columns (first: 1cm, second: 2cm, third: 3cm)
$table->addColumnsList(array(3,3,3));

$cell = $table->getCell(1, 1);
$cell->writeText('Epale');

$sect->writeText('Hello world!', new PHPRtfLite_Font(), new PHPRtfLite_ParFormat());
$archivo = 'hello_world.rtf';
$rtf->save($archivo);
header('Content-type: application/msword');
header('Content-Disposition: attachment; filename='.$archivo);
echo readfile($archivo);
?>
