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

setDataValidation results in a corrupted file from version 1.19.0 #2386

Closed
karmakarpatrick1991 opened this issue Nov 10, 2021 · 3 comments
Closed

Comments

@karmakarpatrick1991
Copy link

karmakarpatrick1991 commented Nov 10, 2021

This is:

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

  1. Show the dropdown from the provided list as per the cell validation.
  2. Set the CellValidation as Number.

What is the current behavior?

We found a problem with some content in ’Bachelor of Science (Hons) (Physics) (44).xlsx’. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes.

What are the steps to reproduce?

<?php

// Create new Spreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();

$validation = $spreadsheet->getActiveSheet()->getCell('C3')->getDataValidation();
$validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
$validation->setErrorStyle(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION);
$validation->setAllowBlank(true);
$validation->setShowInputMessage(true);
$validation->setShowErrorMessage(true);
$validation->setShowDropDown(true);
$validation->setErrorTitle('Input error');
$validation->setError('Value is not in list.');
$validation->setPromptTitle('Pick from list');
$validation->setPrompt('Please pick a value from the drop-down list.');
$validation->setFormula1('"Present,Absent,Withheld,UMC"');

Which versions of PhpSpreadsheet and PHP are affected?

1.19.0 and PhP > 7.1

@karmakarpatrick1991 karmakarpatrick1991 changed the title setdataValidation results in a corrupted file from version 1.19.0 setDataValidation results in a corrupted file from version 1.19.0 Nov 10, 2021
@szabizs
Copy link

szabizs commented Nov 10, 2021

We also encounter this issue since the last update.

@eesau
Copy link

eesau commented Nov 10, 2021

This error is present when file is opened in Microsoft Excel. When opened in LibreOffice Calc it seems to work fine.

@oleibman
Copy link
Collaborator

Closing as a duplicate of #2368. There have been additional PRs since the release of 19.0 which will, I hope, correct your problem. Please test against the most recent PR if possible.

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

4 participants