4

Is it possible to read and write xlsm with macros file with phpexcel?

I tested this code just to replicate the original file:

$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load("file1.xlsm"); 
echo ('Saving...');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('test.xlsm');
header('Cache-Control: max-age=0');

But the new file is different from the original because he has no images.

Thank you.

user3770270
  • 51
  • 1
  • 6
  • How are those images embedded in the Excel file? If they're normal Excel file images, then there should be no issue... if they're generated by the macros then it's unlikely that they'll be preserved because xlsm is not explicitly supported – Mark Baker Mar 24 '15 at 11:25
  • I don't know if is relevant but I extracted the xlsm file and the images are in a folder. – user3770270 Mar 24 '15 at 12:47
  • Well I guess I can look at the code and see why it won't load images from an xlsm file; except that it does in all my tests, and has done for years.... I don't really know what I can do to help – Mark Baker Mar 24 '15 at 12:50
  • Well Mark, my project need to read the original xlsm file and write to another but first i need to test first if i can replicate the original file. I don't know if there any other way to do that. – user3770270 Mar 24 '15 at 12:58
  • If you're able to email the file to me, or post it on the phpexcel issues list [here](http://phpexcel.codeplex.com/workitem/10749) I can take a look – Mark Baker Mar 24 '15 at 13:33
  • What's your email Mark? i'll send you a copy of my file. – user3770270 Mar 24 '15 at 14:12
  • I sent you an email. – user3770270 Mar 24 '15 at 14:41
  • Have you received my emails Mark? – user3770270 Mar 26 '15 at 09:11
  • Hi, I have the same issue. I need to export from XLSM files, do you know any library or any way that can achieve this? – hy0shi Apr 14 '15 at 12:18
  • until now, I couldn't solve the problem – user3770270 Apr 14 '15 at 12:48

1 Answers1

2

PHPExcel doesnot support XLSM fully. Try converting XLSM to XLSX file