Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/04/2013, 22:13
Avatar de gildus
gildus
 
Fecha de Ingreso: agosto-2003
Mensajes: 1.495
Antigüedad: 20 años, 9 meses
Puntos: 105
Respuesta: php a word con PHPWord

Holas,

Intenta cambiando el codigo de la siguiente manera:

Código PHP:
Ver original
  1. require_once 'PHPWord.php';
  2.  
  3. $PHPWord = new PHPWord();
  4.  
  5. // New portrait section
  6. $section = $PHPWord->createSection();
  7.  
  8. // Add text elements
  9. $section->addText('Manizales');
  10. $section->addTextBreak(2);
  11.  
  12. $section->addText('Boletin', array('name'=>'Verdana', 'color'=>'006699'));
  13. $section->addTextBreak(2);
  14.  
  15. $PHPWord->addFontStyle('rStyle', array('bold'=>true, 'italic'=>true, 'size'=>16));
  16. $PHPWord->addParagraphStyle('pStyle', array('align'=>'center', 'spaceAfter'=>100));
  17. $section->addText('Volcán nevado del Ruiz', 'rStyle', 'pStyle');
  18. $section->addText('Sismo Sentido.', null, 'pStyle');
  19.  
  20. $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
  21. $objWriter->save('Boletin.docx');
  22.  
  23. header('Content-type: application/vnd.ms-word');
  24. header("Content-Disposition: attachment; filename=Boletin.docx");
  25. header('Cache-Control: max-age=0');
  26. readfile('Boletin.docx');
  27. unlink('Boletin.docx');




Saludos,
__________________
.: Gildus :.