Custom Library Corrupts the Output of the Export to Excel File

Hello @johnny !

I would like to congratulate you in the progress of Grocery CRUD Enterprise!
I am excited for more updates for this product.
I am currently testing the Grocery CRUD Enterprise v3.0.2 in CodeIgniter 4.3.3

I already observed what causes the excel output to be corrupted and it was when I try to use a custom library I built for my project. This custom library contains many of my reusable functions that’s why I built it. Is there any workaround for this?

By the way this is the prompt of the excel output when opening it:

The file is repairable by a third party software like DataNumen though:


Hello @larasmith ,

That’s great that we at least know the root cause for it. Can you send me some info (in an email I guess because it may have private information?) this third-party library so I can have it a look and maybe point you out to the right direction?

Regards
Johnny

Hi @johnny,

Thank you for the response and apologies if I fail to message immediately.
I was overwhelmed with tasks lately.
I found the workaround for this by adding this line:

ob_end_clean(); 

in the function:

    public function _getGcrud($bootstrap = true, $jquery = true) {
        ob_end_clean(); //This ensures that the exported excel file is not corrupted.
        $db = $this->_getDbData();
        $config = (new ConfigGroceryCrud())->getDefaultConfig();

        $groceryCrud = new GroceryCrud($config, $db);
        return $groceryCrud;
    }
1 Like