Metadata not being set

Topics: Developer Forum, User Forum
Jun 16, 2009 at 2:42 AM

Hi,

I'm currently using v1.6.7 and I'm not able to set the metadata for any file that I'm creating - the properties don't get saved at all. The data in the sheets work flawlessly, it's just the properties that don't.

I'm also trying to unprotect certain cells in the sheet and leaving the majority of the cells protected - when I try to unprotect a range of cells, say, from B2 to N2500, the script runs out of memory. The only feasible range I can unprotect is about 300 cells. I will try the latest code and report back, but I'd like to know a better alternative to what I'm trying to do.

Thanks!

Developer
Jun 16, 2009 at 10:44 AM

>> I'm currently using v1.6.7 and I'm not able to set the metadata for any file that I'm
>> creating - the properties don't get saved at all.

They are supported in PHPExcel for xlsx, but not for xls. You may vote for this work item:
http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=9759

>> The only feasible range I can unprotect is about 300 cells.

Try to use latest source code + the following method:

$sheet->getStyle('B2:N2500')->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);

Jun 16, 2009 at 4:10 PM
Edited Jun 16, 2009 at 4:14 PM

Thanks koyama, voted for it - hope it's implemented soon, but it's no deal breaker :)

Regarding the protection, I did actually try the method that you have suggested earlier as well - still the same. I tried the latest version from the SVN (I was actually using 1.6.6) and that improved things a lot, I'm able to generate the file now - it takes 20 seconds to do it though - a pity considering I only unprotect the 2500 odd cells and don't put any data in it (it's a requirement to unprotect it, users need to enter data in those rows).

In fact, to avoid this issue, I created a template with 2500 rows unprotected and tried opening the file - still the same amount of time is being taken, so no luck there. As a last resort, I wrote a macro that will unprotect those 2500 rows and made phpexcel grab the template, add the rows from the DB and output it - only to find that the macro wasn't there anymore! I'm really out of options - any help would be great!