PHPOffice / PHPExcel

ARCHIVED
Other
11.46k stars 4.19k forks source link

PHPExcel counts more worksheets than there actually are #115

Open ghost opened 11 years ago

ghost commented 11 years ago

$excelObj->getSheetCount() returns more sheets than there actually are in some workbooks. Often, double the amount of sheets is returned, other times more.

When you try to load and then save the same workbook, additional duplicated sheets will appear in the workbook, increasing the file size up to 3 times the original. I couldn't find a pattern to this but it does happen very frequently to my Excel files.

So far, I've observed this issue with xlsx files only.

Please follow the link for attachment 1.xlsx http://phpexcel.codeplex.com/workitem/14261

MarkBaker commented 11 years ago

None of the 4 worksheets attached to this work item give me any problem with extra worksheets. They all load exactly as expected. Can anybody experiencing the problem please do a phpinfo dump to see if there might be any PHP configuration issues that could be triggering this issue.

ghost commented 11 years ago

The issue happens on both my Ubuntu systems, but I just tested it on a Windows machine and the issue does not manifest itself.

I'm looking at the differences in PHP configuration now. The Suhosin patch on both Ubuntu servers does stand out but I don't see how that might cause the issue. I'm looking deeper and will get back to you ASAP.

Hilding76 commented 9 years ago

I've seen this problem sometimes when you are using a .xls saved as .xlsx, however the functions $reader = new PHPExcel_Reader_Excel2007(); $working_sheet_name_list =$reader->listWorksheetNames(); Gives the actual sheets and you can do some $objPHPExcel->removeSheetByIndex($index); inorder to correct it