$config = [
'path' => './'
];
$validation = new \Vtiful\Kernel\Validation();
$validation->validationType(\Vtiful\Kernel\Validation::TYPE_INTEGER)
->criteriaType(\Vtiful\Kernel\Validation::CRITERIA_BETWEEN)
->minimumNumber(1)
->maximumNumber(10);
$excel = new \Vtiful\Kernel\Excel($config);
$filePath = $excel->fileName('tutorial.xlsx')
->header(['Value'])
->validation('A1', $validation->toResource())
->insertText(0, 0, 20) // 不符合约束,并不会写入失败,打开文件时单元格旁边将会出现数据错误提示
->output();
$config = [
'path' => './'
];
$validation = new \Vtiful\Kernel\Validation();
$validation->validationType(\Vtiful\Kernel\Validation::TYPE_INTEGER)
->criteriaType(\Vtiful\Kernel\Validation::CRITERIA_BETWEEN)
->minimumFormula('=A1')
->maximumFormula('=B1');
$excel = new \Vtiful\Kernel\Excel($config);
$filePath = $excel->fileName('tutorial.xlsx')
->header([1, 10])
->validation('C1', $validation->toResource())
->insertText(0, 2, 20)
->output();