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

Fill Style no longer working #2412

Closed
cwolcott opened this issue Nov 24, 2021 · 4 comments
Closed

Fill Style no longer working #2412

cwolcott opened this issue Nov 24, 2021 · 4 comments

Comments

@cwolcott
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?

When creating a fill style it should color the

    protected static $lowControls = [
        'fill' => [
            'fillType' => Fill::FILL_SOLID,
            'startColor' => ['argb' => 'fcdfdf']
        ]
    ];

    protected static $highControls = [
        'fill' => [
            'fillType' => Fill::FILL_SOLID,
            'startColor' => ['argb' => 'e0fde0']
        ]
    ];
        $worksheet->getStyle('G1:I2')->applyFromArray(self::$highControls);

image

What is the current behavior?

Cells are no longer being filled.

image

What are the steps to reproduce?

Define the above styles and apply them.

Which versions of PhpSpreadsheet and PHP are affected?

1.18.0 - When everything was working
Upgrade to 1.20.0 and it did not work.

I will go back to 1.18.0 and then upgrade to 1.19.0 and finally to 1.20.0 to find where the issue was introduced.

@Rockylars
Copy link

You are using an RGB format with ARGB as the format set, either use FF in front of your current format or change your format to be RGB. This was also discussed in #2366.

@cwolcott
Copy link
Author

Yep that fixed it, so sorry that I submitted this. I looked the the release notes for 1.19.0 and 1.20.0 and missed it.

@villarruel
Copy link

After debugging the setARGB function I realized that the function expects a value in hexadecimal but in uppercase, if it sends the color in lowercase the function sets a default color because it falls into an error. Don't add FF before hex if you use setARGB, better use setRGB with only 6 digits for hex.

Después de depurar la función setARGB me di cuenta que la función espera un valor en hexadecimal pero en mayúsculas, si le envía el color en minúsculas la función establece un color predeterminado por que cae en un error. No agreguen FF antes del hexadecimal si usan setARGB, mejor usen setRGB con solo 6 dígitos para hexadecimal.

Saludos.

@cwolcott
Copy link
Author

Agreed using RGB, but I did use lowercase for the argb parameter and it worked fine.

    protected static $highControls = [
        'fill' => [
            'fillType' => Fill::FILL_SOLID,
            'startColor' => ['argb' => 'ffe0fde0'] 
        ]
    ];

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

3 participants