关键在于报错信息部分乱码,无法准确判断哪里出问题了,如:Error [0x8002000e] ��Ч�IJ�����Ŀ��
以下是执行的代码:
$inpath = 'D:\file.xlsx';
$outpath = 'D:\file.pdf';
$excel = new \COM('Excel.Application') or die ("Error: Could not windows excel Object.");
$excel->Visible = 0;
$excel->Workbooks->Open($inpath) or die("ERROR: Unable to open $file");
$sheetname = $excel->ActiveSheet->name;
$excel->ActiveSheet->ExportAsFixedFormat($outpath, 17, false, 0, 0, 0, 0, 7, true, true, 2, true, true, false);
$excel->Quit();
unset($excel);