Open otstrel opened 9 years ago
This "bug" is impossible to fix without changing PHPExcel in such a way that cell caching is completely impossible, with all the memory overheads that would create..... $cell is only a pointer to a current "active" cell. In calling getCell() again to read a different cell, you are changing the "active" cell, so that pointer is now pointing to a different cell; so when you set the value for $cell you're changing the value for the new "active" cell
And before you ask why this isn't explained in the docs..... people reading those docs often have enough difficulty understanding the difference PHP dates and Excel dates, or between workbooks and worksheets.... the docs try to keep things as simple as possible
Thank you for quick response, I really appreciate it. Single active cell makes perfect sense, my code works as expected now. That's a relief!
What I'm still not getting is how single call to setValue changes two cells at once. If there is a single active cell which is being changed by every getCell call then only target cell should be changed by setValue call in my code, shouldn't it?
Regarding documentation I totally welcome your approach. With your amazing activity on StackOverflow it is much easier to start quickly and then search for whatever I come to along the way. I've learned quite a bit from your detailed answers there, thank you very much for these!
It shouldn't change two cells at once, it's something I need to investigate because I've never come across it happening before
Hello,
I'm trying to implement simple template engine which requires indirection feature - ability to set cell value based on some other cell, kind of formula implemented in my code. I stumbled upon pretty strange behavior when setValue call on one cell object changes value of two cells. I narrowed it down to the following piece of code:
Excel files can be found here, template.xls is a, well, template, expected.xls is what I expect to see after I run above code with 1.8.1 and bug.xls is what I'm getting instead. Looks like some weird caching issue to me but hopefully that's just me missing something pretty obvious here.
Regards,
Roman