Skip to content
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

Changing grey background to black in Excel template #2147

Closed
keithslater opened this issue Jun 8, 2021 · 4 comments · Fixed by #2156
Closed

Changing grey background to black in Excel template #2147

keithslater opened this issue Jun 8, 2021 · 4 comments · Fixed by #2156

Comments

@keithslater
Copy link

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?

Not change the cell background color

What is the current behavior?

Grey background cells are changing to black

What are the steps to reproduce?

Create spreadsheet with grey background cells
Use IOFactory::load to load the spreadsheet
Use the Xls writer to write a new spreadsheet

Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:

<?php

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

$spreadsheet = IOFactory::load('input.xls');

$writer = new Xls($spreadsheet);
	header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
	header('Content-Disposition: attachment; filename="output.xls"');
	$writer->save('php://output');

Which versions of PhpSpreadsheet and PHP are affected?

Works fine in 1.16.0. I noticed it broke in 1.18.0. Didn't test 1.17.0.
I did look closer and 1.16.0 has a different shade of grey than what is originally there, but it's not doing what the latest version is doing which turns it to black.

@zagadum
Copy link

zagadum commented Jun 9, 2021

yes critical.
IOFactory load ->give black color

etalon xls file
изображение

IOFactory::load('input.xls');
recive

изображение

@michaljusiega
Copy link

There is problem with XLS. Converted to XLSX will resolve the issue I think.

@zagadum
Copy link

zagadum commented Jun 9, 2021

Converted to XLSX

original file

  1. exel 95
  2. exel 2016
    view.xls
    view.8b7ecd1391dead619fab9e3dd6bfab2a.xlsx

reult from xlsx

изображение

@MarkBaker
Copy link
Member

Can you narrow this down for me: is this a Reader or a Writer issue? Load the spreadsheet, and var_dump the background colour of one of those cells, if it's black at that point, then the problem is in the Reader, if it's still grey and only turns the cell to black when you save, then the problem is in the Writer.... that simple test halves my investigation.
If it works ok if you save as Xlsx, but is wrong when you save as Xls, then that suggests an error in the colour mapping tables for the Xls writer... but can you confirm with that simple diagnostic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants