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

Using an array in Data Validation list #3579

Closed
MarkBaker opened this issue May 20, 2023 · 1 comment
Closed

Using an array in Data Validation list #3579

MarkBaker opened this issue May 20, 2023 · 1 comment

Comments

@MarkBaker
Copy link
Member

          $sheet->setDataValidation($r_cell_address, (new

\PhpOffice\PhpSpreadsheet\Cell\DataValidation())
->setType(\PhpOffice\PhpSpreadsheet\Cell
DataValidation::TYPE_LIST)
->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell
DataValidation::STYLE_INFORMATION)
->setAllowBlank(false)->setShowInputMessage(true)->
setShowErrorMessage(true)->setShowDropDown(true)
->setErrorTitle('Input error')->setError('Value is
not in list.')
->setPromptTitle('Pick from list')->setPrompt('Please
pick a value from the drop-down list.')
->setFormula1('"Entry Level,Leadership"')
);

i can't use array in setFormula1.
How to use array in setFormula1 can you guide me in php?

On Sat, May 20, 2023 at 9:32 AM Henis Chodvadiya @.***>
wrote:

Thank you

On Sat, May 20, 2023 at 9:31 AM Henis Chodvadiya <
@.***> wrote:

Got it.

On Fri, May 5, 2023 at 9:20 PM oleibman @.***> wrote:

The Python code at
https://gist.github.com/Mike-Honey/b36e651e9a7f1d2e1d60ce1c63b9b633 for
converting theme/tint to rgb gets us quite close to our target (final value
is 558ed5 rather than 538dd5). It can probably be adapted to Php; I'm
not sure that the effort is worthwhile.


Reply to this email directly, view it on GitHub
#3550 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/A4KWRH3B27RBX62X6B7IKTDXEUOTPANCNFSM6AAAAAAXVHMAAI
.
You are receiving this because you commented.Message ID:
@.***>

Originally posted by @HenisPatel in #3550 (comment)

@oleibman
Copy link
Collaborator

Closing, because, as far as I can tell, the code above works correctly. It is a little difficult to read, so I will rearrange it slightly to show the code I used, but all of the code involving DataValidation is unchanged:

        $dataValidation = new DataValidation();
        $dataValidation
            ->setType(DataValidation::TYPE_LIST)
            ->setErrorStyle(DataValidation::STYLE_INFORMATION)
            ->setAllowBlank(false)
            ->setShowInputMessage(true)
            ->setShowErrorMessage(true)
            ->setShowDropDown(true)
            ->setErrorTitle('Input error')
            ->setError('Value is not in list.')
            ->setPromptTitle('Pick from list')
            ->setPrompt('Please pick a value from the drop-down list.')
            ->setFormula1('"Entry Level,Leadership"');
        $r_cell_address = 'A1';
        $sheet->setDataValidation($r_cell_address, $dataValidation);

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

No branches or pull requests

2 participants