php - 数据验证不适用于 PhpSpreadsheet
问题描述
当我在某些软件中打开表格时,它说表格有误,需要重置,这仅在我添加列表验证时发生
$sheet = $spreadsheet->getActiveSheet();
$objValidation = $spreadsheet->getActiveSheet()
->getCell('B2')
->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
$objValidation->setFormula1('A,B,C');
$writer = new Xlsx($spreadsheet);
$name = str_replace('.','',str_replace(' ', '',microtime().date('Y h'))).'.xlsx';
$path = 'arquivos/modelo_planilha/'.$name;
$writer->save($path);```
解决方案
推荐阅读
- java - 使用 Spring Boot 验证 Generic Rest Api
- salesforce - 无法安装@salesforce/lwc-dev-server
- excel - 从 Microsoft CSV 读取大数据并写入 AWS 中的 Microsoft Excel 的策略
- amazon-athena - LOCATION 对于 Amazon Athena 中的数据库的用途是什么?
- python - 如何在轴上绘制时间图
- android - 如何使用 SwitcpMap 观察三个数据?
- python - vscode python模块智能感知不起作用
- javascript - 反应透视动画麻烦
- r - 为另一列中的每个唯一值分配一个名称
- python - 根据多个位置删除numpy数组中的项目