Skip to content

No charts are created for xls files #3784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
6 tasks
flyke opened this issue Nov 7, 2023 · 1 comment
Closed
6 tasks

No charts are created for xls files #3784

flyke opened this issue Nov 7, 2023 · 1 comment

Comments

@flyke
Copy link

flyke commented Nov 7, 2023

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?

Convert a .xls spreadsheet with charts to PDF: the PDF contains the same charts

What is the current behavior?

When converting a .xls spreadsheet to PDF, the PDF has no charts at all

What are the steps to reproduce?

<?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('Xls');
      $reader->setIncludeCharts(true);
      $document = $reader->load('demo-xls-file.xls');
      // Set up the writer
      $writer = new ExcelMPDF($document);
      $writer->setIncludeCharts(true);
      $writer->save('demo-xls-file.pdf');

Screenshot of the source xls file:
source-xls-file

Screenshot of the result PDF file:
result-pdf-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 is for .xls files

Which versions of PhpSpreadsheet and PHP are affected?

  • PhpSpreadsheet 1.29.0
  • I'm using PHP 8.1.23
@oleibman
Copy link
Collaborator

oleibman commented Nov 7, 2023

You are unfortunately correct. There is no support for charts for xls. There is also precious little information on how to generate or read a chart in the BIFF format which xls uses. I have added a note to issue #3403 to formally document this lack of support, and will therefore close this issue now. Sorry.

@oleibman oleibman closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants