Strange output quirks

May 7, 2015 at 2:45 PM
I've been using PHPExcel for a while, and although I love it, there is one quirk that has been driving me crazy - - so I'm hoping someone on here has a suggestion how to work around it?

I've been using PHPExcel on a server to generate XLS files for upload into our IT system. The problem is that there is something about the PHPExcel output that isn't quite exactly the same. If I try to upload one of the files directly into our IT system, it will fail. However, if I open the file in Excel and then immediately re-save it, it works perfectly?

The file looks identical to the naked eye, and even the file size being reported shows as the same. But if I run an "FC" in Windows against the 2 files, it does identify some differences.

Short of continuing to open/resave files, is there anything that can be done to adjust the output to a more "true" Excel file? (and yes, I've already explored automating the open/resave... but I'd rather not have to if at all possible)
Comparing files C:\USERS\Me\DESKTOP\WKFILE\test_no_resave.xls and C:\USERS\Me\DESKTOP\WKFILE\TEST_WITH_RESAVE.XLS
***** C:\USERS\Me\DESKTOP\WKFILE\test_no_resave.xls

€¤ZЯˆÐ@

***** C:\USERS\Me\DESKTOP\WKFILE\TEST_WITH_RESAVE.XLS

€\±¯ˆÐ@

*****

***** C:\USERS\Me\DESKTOP\WKFILE\test_no_resave.xls

€¤ZЯˆÐ

***** C:\USERS\Me\DESKTOP\WKFILE\TEST_WITH_RESAVE.XLS

€\±¯ˆÐ

*****

***** C:\USERS\Me\DESKTOP\WKFILE\test_no_resave.xls

;óЯˆÐ
;óЯˆÐ

***** C:\USERS\Me\DESKTOP\WKFILE\TEST_WITH_RESAVE.XLS

©ô±¯ˆÐ
©ô±¯ˆÐ
Oct 12, 2015 at 2:44 PM
bump

Anyone?
Jan 7 at 10:21 AM
Hi, i have the same problem, had you solved it?

Tks
S
Jan 9 at 1:11 AM
I've had some communication with Mark Baker over at GitHub. https://github.com/PHPOffice/PHPExcel/issues/720#issuecomment-154250594

In short, he's aware that I was having a problem.... but I haven't heard if a root cause or fix has been found yet. I did come up with a workaround, though - - running a script through LibreOffice to basically open the output file & re-save it to Excel format. It's not ideal, but it does the trick?
$command = 'export HOME=/opt/lampp/htdocs/converter && sudo libreoffice --headless --convert-to %s --outdir "%s" "%s"';
$command = sprintf($command, $toFormat, $outputDirPath, $originFilePath);
exec($command, $output);
Jan 9 at 12:23 PM
Thank you for your answer.
I'm afraid i will not be able to apply your workaround because i'm running on a public hosted web server.

Bye
S