KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Export To Excel - possible bug #1694

Closed MarkoS opened this topic on on Oct 31, 2020 - 3 comments

MarkoS commented on Oct 31, 2020

Hi all,

During implementation for Excel export function, I have found possible bug. I am not using any fancy formatting or options, example what I have in my Controller is below: (I am using codeigniter and running render directly, ignore that) `

 $export_status = isset($_GET['export']) ? $_GET['export'] : 'no';
 if($export_status == 'yes') {

$vars['report'] = $report->run()->exportToExcel()->toBrowser("SumiranaProdaja.xlsx"); } else { $vars['report'] = $report->run(); $this->fuel->admin->render('_admin/dnevni', $vars, Fuel_admin::DISPLAY_NO_ACTION); // render Admin section of UI } ` And my View is using DataGrid to display data. On top of that I have html coded buttons like below.

<!--Exports are wrong with click on button below -->
                    <div class="form-group text-center">
                            <button class="btn btn-success sivo"><a href="prodajaSumirano?export=yes" class="ico ico_export">   Export to Excel</a> </button>
                    </div>
                    
                    <!--Fixed btn-->
                    <div class="form-group text-center" style="margin-left: 20px;">
                        <button type="submit" class="btn btn-success sivo" formaction="prodajaSumirano?export=yes">Export to Excel</button>
                    </div>

A: If I click on first button with "a href", export runs and exported file contains 2 spread sheets where first one has only column names and no data, but second spreadsheet is populated properly.

B: If I click on button with "formaction" it does run export process and exports all data in both spread sheets.

Conclusion - It is strange that first spreadsheet is never populated, but second, third, forth .... are populated properly.

Another thing, by using example below, I can't see Excel and PDF buttons. I was wondering why..? (I am using DataGrid 5.0 Beta, if that makes any difference) `

        "dom" => 'Bfrtip',
                "buttons" => [
                    'copy', 'csv', 'excel', 'pdf', 'print'
                ],

KoolReport commented on Nov 1, 2020

Thanks Marko for letting us know. I will tell dev.team to investigate the issue and keep you update.

Sebastian Morales commented on Nov 2, 2020

Marko, the difference between a href and a button is that clicking the href doesn't submit the form while clicking the button does. Therefore there could be difference in your report's data depending on how your report use submitted form data.

MarkoS commented on Nov 2, 2020

Hi Sebastina, thx for reply. That makes sense, It was just strange that there is partial export. That's okey, I will close this topic than.

Thanks guys

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

None