PHP Spreadsheet Laravel Dropdown allowing only 255 characters ,How to exceed Character limit?
Get the solution ↓↓↓Im using PHP Spreadsheet in Laravel and i need to show list of states in dropdown,Im not able to show states once 255 character limit is passed ,I searched in Stackoverflow but every answer is not helpful and confusing,Can anyone explain how i can exceed character limit ?
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->SetCellValue( "A1", "Country" );
$sheet->SetCellValue( "B1", "State" );
$sheet->SetCellValue( "C1", "City" );
$sheet->SetCellValue( "D1", "Location" );
$sheet->SetCellValue( "A2", "India" );
$getstate = DB::table('states')->where('status',1)->get();
foreach($getstate as $st)
{
$states.=$st->state_name.",";
}
$state = rtrim($states, ',');
$objValidation = $sheet->getCell('B2')->getDataValidation();
$objValidation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( \PhpOffice\PhpSpreadsheet\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->setPromptTitle('Pick from list');
$objValidation->setPrompt('Please pick a value from the drop-down list.');
$objValidation->setFormula1('"'.$state.'"');//note this!
$writer = new Xlsx($spreadsheet);
$writer->save('php.xlsx');
If i open sheet it gives error.Please guide me on how to do it
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: the process class relies on proc_open, which is not available on your php installation.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.