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

Data Validation #4091

Open
bokrma opened this issue Jul 8, 2024 · 2 comments
Open

Data Validation #4091

bokrma opened this issue Jul 8, 2024 · 2 comments

Comments

@bokrma
Copy link

bokrma commented Jul 8, 2024

Currently in the functionality there is only way to set validation per cell
public function setDataValidation(string $cellCoordinate, ?DataValidation $dataValidation = null): static
and the get also return the range as parts:
$this->worksheet->getDataValidationCollection();

can we let it return as defined in the excel file:
and also set as range instead of cell by cell
Screenshot 2024-07-08 at 16 12 21

@oleibman
Copy link
Collaborator

It would be helpful to know what you have in mind. Changing the way the Data Validations are stored would be quite difficult. But I'm guessing that you want to emulate Excel's Data Validation "Apply these changes to all other cells with the same settings". If that is the case, a less difficult solution presents itself. You would need two new methods - one which returns a list of all cells with the same Data Validation as a given cell, and another which copies a Data Validation to a list of cells. Then you could do something like:

$cellList = $sheet->getIdenticalDataValidationList($targetCell);
// apply changes to $targetCell->dataValidation
$sheet->copyDataValidation($targetCell, $cellList);

Would that satisfy your requirement?

@bokrma
Copy link
Author

bokrma commented Jul 16, 2024

I will try it out, thank you!

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