I have recently begun working with/learning to use PHPExcel and I am encountering some issues with the process of loading a "template" file and then saving it.
The issue I'm experiencing is that some, but not all, of the formulas and cell formatting are being lost when I load the file and then save it (without making any changes to the content) using the Excel5 reader/writer.
I ran the "30template.php" test file (I also ran other test files but this is the one that is pertinent to my intended usage) and almost everything worked fine. The only difference between the input and output files is
that in the output file; the green formatted text ("payable within 30 days after the end of the month") comes out as unformatted black text (like the rest of the text in that cell). Everything else looks exactly like it does in the original
templates/30template.xls source file.
I then copied the 30template.php file to a new test file and modified it so that it would load my sample (XLS) file. I also removed the code that adds new content to the file but, other than that, no other code was changed. This new test file
simply loads the file and saves it back "as-is". Eventually I plan to use this in a load-modify-save scenario but I'm currently limiting it to the load-save parts to reduce the number of things to troubleshoot.
When I do this some, but not all, of the cells that contain formulas come out completely empty (i.e. no formulas or content of any kind) and lose all formatting (those cells have currency formatting set in the source file). Other cells which
also contain (similar) formulas and currency formatting remain intact though (i.e. the formulas and formatting are still in the output file). The cells that come out empty are B6:M6, B8:M8, D9:M9, B14:M14, B16:M16, and B27:M27.
I then tried the same code with an XLSX format file. The XLSX file was created by opening the XLS file in Excel and saving it as an XLSX file. The test code was updated to use the Excel2007 reader/writer but otherwise unchanged from the
initial test. When running this; the output file comes out with all of the formulas intact but the currency formatting is then lost in any cell that contains a formula (i.e. all of the formatting is set to "general").
In both test cases the formatting for any cell that does not contain a formula is retained perfectly.
After reading the documentation, discussions, and bug tracker and several days of experimenting; I am stumped as to what is happening to cause this behavior. The only formulas in the workbook are SUM formulas (a few have some additional multiplication
or division as well). I'm not sure if this is an issue with the server, test code, Excel file, or a bug. No error messages are produced during the test run(s).
The environment is:
Server: Redhat Enterprise 5
PHP version: 5.2.12 (also tested with 5.2.13 on a completely different server running CentOS with the same results)
PHPExcel version: 1.7.5 and snapshot 66707 (tried 66707 after encountering the issues using 1.7.5)
The test file I'm using will be uploaded shortly.