Home >Backend Development >PHP Tutorial >PHP Word & Excel to PDF

PHP Word & Excel to PDF

WBOY
WBOYOriginal
2016-07-25 08:47:451551browse
Windows + Microsoft Office 2013 only!
                   
                               
                                       
                                       
            
  1. function wd2pdf($ori, $dst)
  2. {
  3.         $winword = new COM('Word.Application');
  4.         $document = $winword->Documents->Open($ori);
  5.         $document->ExportAsFixedFormat($dst, 17);
  6.         $document->Close();
  7.         $winword->Quit();
  8. }
复制代码
                                           
                                       
                                       
            
  1. function xl2pdf($ori, $dst)
  2. {
  3.         $excel = new COM('Excel.Application');
  4.         $workbook = $excel->Workbooks->Open($ori);
  5.         $workbook->ExportAsFixedFormat(0, $dst);
  6.         $workbook->Close();
  7.         $excel->Quit();
  8. }
复制代码


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Super simple PHPMVCNext article:Super simple PHPMVC