PHP将Excel文件从“.xls”转换为“.xlsx”

时间:2023-01-15 10:40:56

im working in a php project in witch i have to send a mail with an excel attachment , for the mail im using phpmailer. Im having a problem with the format of the excel file that the code below produces.

即时通讯工作在一个php项目中,我必须发送一封带有excel附件的邮件,邮件即时通讯使用phpmailer。我有下面代码生成的excel文件格式的问题。

$table.='<table></table>';
    if (file_exists("EXCEL REPORT/".$subject." ".date("M-d-Y").".xls")) 
    {
        unlink("EXCEL REPORT/".$subject." ".date("M-d-Y").".xls");
        file_put_contents("EXCEL REPORT/".$subject." ".date("M-d-Y").".xls", $table); 
        sendmailatt($to,$cc,$subject." ".date("M-d-Y"),"mail",<br>REGIA","EXCEL REPORT/".$subject." ".date("M-d-Y").".xls");
    } 
    else {
       file_put_contents("EXCEL REPORT/".$subject." ".date("M-d-Y").".xls", $table); 
       sendmailatt($to,$cc,$subject." ".date("M-d-Y"),"Questo e' un invio automatico del venduto per agent.<br><br>Saluti,<br>REGIA","EXCEL REPORT/".$subject." ".date("M-d-Y").".xls");
    }

i want to convert the attachment into excel 2007 before sending the mail... is there any easy way for achieving this

我想在发送邮件之前将附件转换为excel 2007 ...有没有简单的方法来实现这一点

1 个解决方案

#1


0  

There is PHPExcel. You can find the documentation for reading and writing files here

有PHPExcel。您可以在此处找到有关读取和写入文件的文档

#1


0  

There is PHPExcel. You can find the documentation for reading and writing files here

有PHPExcel。您可以在此处找到有关读取和写入文件的文档