Foros del Web » Programando para Internet » PHP »

PHPExcel Llenar datos desde un HTML

Estas en el tema de PHPExcel Llenar datos desde un HTML en el foro de PHP en Foros del Web. Que tal foro, espero me puedan ayudar tengo un formulario en html y quiero que guarde esta información en un Excel comencé a usar la ...
  #1 (permalink)  
Antiguo 09/04/2015, 14:59
 
Fecha de Ingreso: abril-2015
Mensajes: 1
Antigüedad: 8 años, 11 meses
Puntos: 0
Pregunta PHPExcel Llenar datos desde un HTML

Que tal foro, espero me puedan ayudar tengo un formulario en html y quiero que guarde esta información en un Excel comencé a usar la librería de PHPExcel pero no eh encontrado nada que me ayude espero y me puedan ayudar mi codigo HTML es este

Código HTML:
<html>
<head>
   	<title>Captura Datos Agente</title>
   	<meta charset="utf-8">
    <style>        
        input {text-transform: uppercase;}
    </style>
   
</head>
<body>
	<center><img src="registrado.png" width="200" height="150" /><br /><br />
			<font face="Copperplate Gothic Bold" color="#000000" ><em  style="font-size:35brx;"><STRONG>REPORTE DE CONTIZACIONES</STRONG></em></font><br /><br />
	
	
		<center>
			<form action="texto1.php" method="post" enctype="multipart/form-data" name="formredac">
				<strong>Fecha:</strong><Input name="dia" type="date" style="text-aling:center"> 
				<strong>Usuario:</strong> <Input name="usr" size="25" maxlength="25" style="text-align:center" ><p />				
				<strong>Agente:</strong><Input name="agnt" size="30" maxlength="30" style="text-align:center" >
				<p /><strong>Via: <Input name="via" size="15" maxlength="15" style="text-align:center" ><p />
				<p /><strong>Uso de Unidad:<Input name="unidad" size="15" maxlength="15" style="text-align:center" >
				<!--<p/><strong> Clave de vehiculo:<Input name="cau" size="15" maxlength="5" style="text-align:center" >-->
				<p/><strong> Modelo:<Input name="mod" size="5" maxlength="4" style="text-align:center" >
				<p/><strong> Descripcion: <Input name="dcp" size="40" maxlength="40" style="text-align:center" >
			
		</center>
	<!-- Compañias-->
	<table width="80%" border="0" cellspacing="10" cellpadding="0" style="border-top-width:3px; border-top-style:solid; border-top-color:#a2c3e3;"> 
	<tr>
		<font face="Copperplate Gothic Bold" color="#000000" ><em  style="font-size:30rx;"><STRONG>Compañia Con la que Cotizó y Clave de Vehiculo</STRONG></em></font><br /><br />
	</tr>
			<tr>
				<td><strong>Banorte	<input name="bnte" size="6" maxlength="5" style="text-align:center"> </td>
				<td><strong>Afirme	<input name="afrm" size="5" maxlength="4" style="text-align:center"> </td>
				<td><strong>Qualitas	<input name="qlts" size="10" maxlength="8" style="text-align:center"> </td>
				<td><strong>Aba	<input name="aba" size="17" maxlength="15" style="text-align:center"> </td>
			</tr>
			<tr>
				<td><strong>Latino<input name="ltn" size="5" maxlength="4" style="text-align:center"> </td>
				<td><strong>Mapfre<input name="mpf" size="10" maxlength="15" style="text-align:center"> </td>
				<td><strong>Primero<input name="pmo" size="10" maxlength="15" style="text-align:center"> </td>
			</tr>
		
	</table>
	<!-- Cobertuiras-->
	<table width="80%" border="0" cellspacing="10" cellpadding="0" style="border-top-width:3px; border-top-style:solid; border-top-color:#a2c3e3;">  
		<p>
			<input type="checkbox" name="amp" class="formulario_check"> Amplia
			<input type="checkbox" name="lim" class="formulario_check"> Lim
			<input type="checkbox" name="rc" class="formulario_check"> RC
	</table>
	<!-- Forma de Pago-->
	<table width="80%" border="0" cellspacing="10" cellpadding="0" style="border-top-width:3px; border-top-style:solid; border-top-color:#a2c3e3;">  
		<p>
			<input type="checkbox" name="anl" class="formulario_check"> Anual
			<input type="checkbox" name="sem" class="formulario_check"> Semestral
			<input type="checkbox" name="
			" class="formulario_check"> Trimestral
			<input type="checkbox" name="men" class="formulario_check"> Mensual
	</table>
<!--<p /><img src="../captcha.php" width="100" height="30"><p> 
<input name="tmptxt" type="text" style="text-align:center"><p> -->
<P><input name="" type="submit" value="Enviar" /> </p>
<input name="action" type="hidden" value="checkdata"> 
</form></center>

</body>
</head> 
y mi codigo que guarda la informacion es este de PHPExcel

Código PHP:
<?php 

session_start
(); 
if (
$_POST['action'] == "checkdata") { 
 
include_once(
"PHPExcel.php"); 

$file="prueba.xlsx";

//Inserta datos capturados en HTML a celdas especificas

$Reader PHPExcel_IOFactory::createReaderForFile($file);
$objXLS $Reader->load($file);

/* overwrite a cell value */
$objXLS->getSheet(0)->getCell('B3')->setValue(46);

$prueba = new PHPExcel(); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("B3",$_POST["usr"]); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("E3",$_POST["agnt"]); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("F3",$_POST["via"]); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("G3",$_POST["unidad"]); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("H3",$_POST["mod"]); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("I3",$_POST["dcp"]); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("J3",$_POST["bnte"]); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("K3",$_POST["afrm"]); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("L3",$_POST["qlts"]); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("M3",$_POST["aba"]); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("N3",$_POST["ltn"]); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("O3",$_POST["mpf"]); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("P3",$_POST["pmo"]); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("Q3",$_POST["amp"]); 
            
$prueba->setActiveSheetIndex(0)->setCellValue("R3",$_POST["lim"]);
            
$prueba->setActiveSheetIndex(0)->setCellValue("S3",$_POST["rc"]);
            
$prueba->setActiveSheetIndex(0)->setCellValue("T3",$_POST["anl"]);
            
$prueba->setActiveSheetIndex(0)->setCellValue("U3",$_POST["sem"]);
            
$prueba->setActiveSheetIndex(0)->setCellValue("V3",$_POST["trim"]);
            
$prueba->setActiveSheetIndex(0)->setCellValue("V3",$_POST["men"]);

//Titulo de la Hoja
$prueba->getActiveSheet()->setTitle("Reporte"); 
//Guarda el archivo excel
$objWriter PHPExcel_IOFactory::createWriter($prueba'Excel2007'); 
$objWriter->save('prueba.xlsx'); 
    
echo 
"<p>Su texto fue enviado correctamente y esta pendiente de verificacion.</p><p><a href='captura_texto1.html'>Volver al inicio</a></p>";

}
?>
Para mas clara mi pregunta, quiero que guarde todo lo que se capture al día en un mismo excel pero no logro hacerlo se los agradeceri mucho

Etiquetas: excel, html, phpexcel
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:12.