Skip to content

Rendered charts from .xlsx file dont look like original charts. There is even a chart missing. #3783

Open
@flyke

Description

@flyke

This is:

- [* ] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

When I have a spreadsheet with charts, and I write it to html or PDF, I expect the the charts in the html or PDF to be like the charts in the source spreadsheet

What is the current behavior?

In the rendered html/pdf:

What are the steps to reproduce?

  • Use the attached xlsx file
    demo-excel.xlsx

  • Use this code to create PDF from the xlsx file.

<?php
use PhpOffice\PhpSpreadsheet\IOFactory as SpreadsheetIOFactory;
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf as ExcelMPDF;

      // Set a class which will render the charts.
      \PhpOffice\PhpSpreadsheet\Settings::setChartRenderer(
        \PhpOffice\PhpSpreadsheet\Chart\Renderer\MtJpGraphRenderer::class
      );
      // Load the document.
      $reader = SpreadsheetIOFactory::createReader('Xlsx');
      $reader->setIncludeCharts(true);
      $document = $reader->load('demo-excel.xlsx');
      // Set up the writer
      $writer = new ExcelMPDF($document);
      $writer->setIncludeCharts(true);
      //$writer->writeAllSheets();
      // Create PDF file.
      $writer->save('demo-excel.pdf');

Screenshots attached.
result-pdf-file
source-xlsx-file

What features do you think are causing the issue

  • Reader
  • [* ] Writer
  • Styles
  • Data Validations
  • Formula Calculations
  • [* ] Charts
  • AutoFilter
  • Form Elements

Does an issue affect all spreadsheet file formats? If not, which formats are affected?

This issue is now only for XLSX files. I have a very comparable XLS file, but that does not render any chart, so thats a different issue altogether.

Which versions of PhpSpreadsheet and PHP are affected?

  • PhpSpreadsheet 1.29.0
  • I'm using PHP 8.1.23

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions