PHPOffice / PhpSpreadsheet

A pure PHP library for reading and writing spreadsheet files
https://phpspreadsheet.readthedocs.io
MIT License
13.34k stars 3.46k forks source link

Chart styling is lost on simple load / save process #1797

Closed lawless-m closed 2 years ago

lawless-m commented 3 years ago

This is:

- [ x] 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?

Output styling should be the same format as the input

What is the current behavior?

Styling is not preserved

What are the steps to reproduce?

ChartInput.xlsx

ChartOutput.xlsx


<?php

require __DIR__ . '/vendor/autoload.php';

$reader = IOFactory::createReader('Xlsx');
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load('ChartInput.xlsx');

$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');    

$writer->setIncludeCharts(true);
$writer->save('ChartOutput.xlsx');

?>

### Which versions of PhpSpreadsheet and PHP are affected?

## 1.16.0 - 2020-12-31

 php --version
PHP 7.4.3 (cli) (built: Oct  6 2020 15:47:56) ( NTS )
pierre-H commented 2 years ago

Same problem 😢

kozhevnikovpe commented 1 year ago

not fixed try to run code from 1st message saved file looks different

oleibman commented 1 year ago

@kozhevnikovpe It makes things a lot easier if you describe the differences you see rather than just "saved file looks different". It also helps if you open new issues (possibly cross-referencing the closed issue in your description) rather than keep adding to an issue that was closed 8 months ago.

The sample file 32readwriteLineChart5 was added for the PR which addressed this issue. They are very close, but I agree that there are still some discrepancies.

Can you please open separate issues for each of these, and any other discrepancies that you see. I think I am pretty close to a solution for the first two. The third may require a lot more effort.