Quantcast
Channel: PHPExcel Forum Rss Feed
Viewing all articles
Browse latest Browse all 2707

New Post: How to detect and remove hidden columns

$
0
0
I am using PHPExcel version 1.8 and uploading Excel files using the Excel5 reader object. The Excel files that get uploaded are somewhat inconsistent and one in particular will come in with a column hidden. I need to be able to detect if/when this column is hidden and delete it if it is hidden. I have been able to delete the hidden column by using the following:
$worksheet->removeColumn('B');
However, as I mentioned the column isn't always hidden and therefor needs to be detected prior to deleting. I've tried to use this code below to detect and remove the column only when it's hidden:
if ($worksheet->getColumnDimension('B')->getVisible(false)) {
    $worksheet->removeColumn('B');
}
What am I doing wrong and can someone please help me understand getVisible better since I cannot seem to find much documentation on this. Thank you in advance for any help.

Viewing all articles
Browse latest Browse all 2707