【发布时间】:2022-08-16 13:55:57
【问题描述】:
Use PHPExcel to create a dropdown in an excel file:
$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
$configs1 = \"Lorem Ipsum is simply, dummy text of the printing, and typesetting
industry, Lorem Ipsum has been, the industrys standard, dummy text ever, since the
1500s, when an unknown printer, took a galley of type, and scrambled it to make, a
type specimen book, It has survived not only ,five centuries, but also the leap ,into
electronic typesetting, remaining essentially, unchanged, It was popularised, in the
1960s with the, release of Letraset sheets, containing Lorem Ipsum ,passages, and
more recently, with desktop publishing, software like Aldus, PageMaker including,
versions of Lorem Ipsum,Lorem Ipsum is simply, dummy text of the printing, and
typesetting industry, Lorem Ipsum has been, the industrys standard, dummy text ever,
since the 1500s, when an unknown printer, took a galley of type, and scrambled it to
make, a type specimen book, It has survived not only ,five centuries, but also the
leap ,into electronic typesetting, remaining essentially, unchanged, It was
popularised, in the 1960s with the, release12345\";
$objValidation = $objPHPExcel->getActiveSheet()->getCell(\'I2\')->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
$objValidation->setAllowBlank(false);
$objValidation->setShowInputMessage(true);
$objValidation->setShowErrorMessage(true);
$objValidation->setShowDropDown(true);
$objValidation->setErrorTitle(\'Input error\');
$objValidation->setError(\'Value is not in list.\');
$objValidation->setFormula1(\'\"\'.$configs1.\'\"\');
$objPHPExcel->setActiveSheetIndex(0);
PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
$result = $objWriter->save($template_save_file);
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
下图显示了另外 1022 个字符及其细分下拉列表。
下图显示 1022 个字符工作正常。
问题是在添加更多字符下拉中断后,下拉菜单适用于 1022 个字符。
怎么能增加字数限制?
-
MS Excel 有其局限性。有时,增加这些限制的唯一方法是给微软写一封“拜托了”的信。但是你到底为什么要使用一个值这么大的 DataValidation 下拉菜单呢?您似乎没有将它用于实际的 DataValidation,而是用作 Cell 注释;那么为什么不实际使用单元格注释呢?
标签: php excel export dropdown phpexcel