Advertisement
jamboljack

Skrip CI

Feb 29th, 2016
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.84 KB | None | 0 0
  1. $id_pemohon = $this->uri->segment(4);
  2.         $detail = $this->apotik_model->select_detail_pemohon($id_pemohon)->row();      
  3.  
  4.         $xnomor     = $detail->no_register;
  5.         $xnmapotik  = $detail->nama_apotek;        
  6.  
  7.         $this->load->library('PHPWord');
  8.         $PHPWord = new PHPWord();
  9.         $document = $PHPWord->loadTemplate('template_surat/piagam_apotek1.docx');      
  10.         $document->setValue('nomor1', $xnomor);
  11.         $document->setValue('vnamaapotek', $xnmapotik);    
  12.        
  13.         $time = time();
  14.         $filename = 'Piagam_apotek_'.$time.'.docx';
  15.         //$document->save($filename);
  16.         header("Content-type: application/vnd.ms-word");
  17.         header('Content-Disposition: attachment;filename="'.$filename.'"'); //tell browser what's the file name
  18.         header('Cache-Control: max-age=0'); //no cache
  19.         $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
  20.         $objWriter->save($filename);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement