Good morning I am trying to create a function with php that fills in the title fields automatically, but when I try to pass the arrangement where I have my titles, I get the following error: "Uncaught Error: Call to undefined function createTitles ( ) ", Does anyone have an idea of how to solve it?
$tituloHojaAlp = array('ID', 'línea', 'Modelo', 'Submodelo', 'Detalle1', 'Detalle2','Descripción','Compra Web', 'Formato', 'Moneda', 'Notas','Orden', 'Salto', 'Alcance', 'Amca', 'Hmx');
function crearTitulos($objPHPExcel,$arrayTitulos){
$columnasEx = array('A1','B1','C1','D1','E1','F1','G1','H1','I1','J1','K1','L1','M1','N1','O1','P1','Q1','R1','S1','T1','U1','V1','W1','X1','Y1','Z1');
$long = count($arrayTitulos);
$conColum = count($columnasEx);
//ALP
for ($i=0; $i <=$long ; $i++) {
if ($long == $conColum) {
goto fuera;
}else{
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue($columnasEx[$i], $arrayTitulos[$i]);
}
}
fuera:
}
crearTitulos($objPHPExcel,$tituloHojaAlp);