KoolReport's Forum

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

Export Excel Reorder the column #329

Open V Vijaykumarr opened this topic on on Jun 21, 2018 - 1 comments

V Vijaykumarr commented on Jun 21, 2018

Hello,

The exported excel column order is different from the View, How to fix that?

Thanks.

David Winterburn commented on Jun 22, 2018

Hi there,

At the moment the ExcelExportable trait does not have that option yet but you could get it from changing the columns' order before saving to the datastore like this:

->pipe(new \koolreport\processes\Map(array(
    '{meta}' => function($meta) {
        $exportedColumns = ['column2', 'column3', 'column1', 'column0'];
        $newMeta = ['columns' => []];
        foreach ($exportedColumns as $col)
            $newMeta['columns'][$col] = $meta['columns']['col'];
        return $newMeta;
    },
)))
->pipe($this->dataStore('exportedDatastore1'));

If this doesn't work for you, please send an email to support@koolphp.net, we will send you the latest version of ExcelExport.php. Thanks!

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

Export