KoolReport's Forum

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

Excel's BarChart create trouble #1837

Closed Epitello opened this topic on on Jan 11, 2021 - 6 comments

Epitello commented on Jan 11, 2021

Hello, i try to export a view to excel, when i render only one table it's work fine but when i add a barchart the excele file display this : {""name"":""ExcelTable5ffc52be1b0161""} {""name"":""ExcelWidget5ffc52be1b1ec2""}. Do you have any solution for this ? thanks by advance

Epitello commented on Jan 11, 2021

i'll send you the view code :

<?php
    use \koolreport\excel\Table;
    use \koolreport\excel\PivotTable;
    use \koolreport\excel\BarChart;
    use \koolreport\excel\LineChart;

    $sheet1 = "Sales by Customer";
?>
<meta charset="UTF-8">
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="Excel,HTML,CSS,XML,JavaScript">
<meta name="creator" content="John Doe">
<meta name="subject" content="subject1">
<meta name="title" content="title1">
<meta name="category" content="category1">

<div sheet-name="<?php echo $sheet1; ?>">
    <div>
        <div>
            <?php
            $chart = ['chart1' => [
                'nom'=>'chart1',
                'type' => ['bar'],
                'colonnes'=>['departement', 'montant'],
                'dataSource'=>'assuranceDS'
            ]];
            Table::create(array(
                "dataSource" => $this->dataStore('assuranceDS'),
                // "dataSource" => 'orders',
                // "filtering" => ['age','between',45,65],
            ));
            ?>
        </div>
        <div range="A25:H45">
            <?php
            BarChart::create([                        
                'dataSource' => $this->dataStore('assuranceDS'), //table_0, table_1
                'title' => $chart['chart1']['nom'],
                'xAxisTitle' => 'Montant',
                'yAxisTitle' => 'departement',
                'column' => $chart['chart1']['colonnes']
            ])
            ?>
        </div>
    </div>
    
</div>
Epitello commented on Jan 11, 2021

i have try with fixed value for title and column but the issue is the same

Sebastian Morales commented on Jan 12, 2021

Pls try replacing this line:

    'column' => $chart['chart1']['colonnes']

with this one:

    'columns' => $chart['chart1']['colonnes'] //use "columns", not "column"

Let us know the result. Tks!

Epitello commented on Jan 12, 2021

thanks for your answer. The result is the same, the excel file retur that : "{""name"":""atat""} {""name"":""ExcelWidget5ffd59e5b848c1""}"

Sebastian Morales commented on Jan 12, 2021

I think you have three levels of <div> inside your excel view. It's supposed to have two <div> levels, the first one represents a sheet, the second one represents an widget (table, chart, text, pivottable, etc). Pls remove one level of <div> to see if it works.

Epitello commented on Jan 12, 2021

it works fine 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
solved

Excel