reporte en excel
Publicado por Hfr (93 intervenciones) el 26/04/2016 22:20:06
Hola chicos como están. espero que bien
yo he hecho varios resortes con excel de esta forma
funcionan sin problema.
yo hago unos reportes con con un archivo RTF, Ahora esos reportes me los cambiaron por un archivo ecxel,
el excel viene con una formulario ya definido, entonces quería saber si el reporte nuevo en excel se puede hacer de una forma muy similar como construi el RTF DE Word, para no hacerlo como definí el primer código
agradezco sus opiniones y comentarios.
yo he hecho varios resortes con excel de esta forma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
include ("../con_mysql.php");
$linkx = new conexion();
$xCon= $linkx->conectar();
/********************************************
Write the query, call it, and find the number of fields
********************************************/
$xconsulta =mysqli_query($xCon, "select * from tabla");
$campos = mysqli_num_fields($xconsulta);
$i=0;
ob_start();
echo " <center><table border=\"1\" align=\"center\" CELLPADDING=\"0\">";
echo "<tr bgcolor=\"#336666\" WIDTH=\"40\" HEIGHT=\"30\">
<td><font color=\"#ffffff\"><strong>id principal</strong></font></td>
<td><font color=\"#ffffff\"><strong>id princpal del nnaj</strong></font></td>
<TD><font color=\"#ffffff\"><strong>fecha</strong></font></TD>
<td><font color=\"#ffffff\"><strong>desiscion</strong></font></td>
<td><font color=\"#ffffff\"><strong>resolucion de conflictos </strong></font></td>
<td><font color=\"#ffffff\"><strong>relaciones interpersonales </strong></font></td>
<td><font color=\"#ffffff\"><strong>persepcion de si mismo</strong></font></td>
<td><font color=\"#ffffff\"><strong>reconocimiento culturales </strong></font></td>
</tr>";
while($row=mysqli_fetch_array($xconsulta))
{
echo "<tr>";
for($j=0; $j<$campos; $j++) {
echo "<td>".$row[$j]."</td>";
}
echo "</tr>";
}
echo "</table>";
//$reporte = ob_get_clean();
/********************************************
Write the query, call it, and find the number of fields
/********************************************/
$xconsulta2 =mysqli_query( $xCon, "SELECT * from noticias");
$campos2 = mysqli_num_fields($xconsulta2);
$i2=0;
//ob_start();
echo " <center> <div class=\"CSSTableGenerator\" ><table border=\"1\" align=\"center\">";
echo "<tr bgcolor=\"#336666\">
<td><font color=\"#ffffff\"><strong>ID</strong></font></td>
<td><font color=\"#ffffff\"><strong>TITULAR</strong></font></td>
<TD><font color=\"#ffffff\"><strong>RESUMEN</strong></font></TD>
<td><font color=\"#ffffff\"><strong>NOTICIA</strong></font></td>
<td><font color=\"#ffffff\"><strong>IMAGEN</strong></font></td>
<td><font color=\"#ffffff\"><strong>FECHA</strong></font></td>
</tr>";
while($row2=mysqli_fetch_array($xconsulta2))
{
echo "<tr>";
for($j2=0; $j2<$campos; $j2++) {
echo "<td>".$row2[$j2]."</td>";
}
echo "</tr>";
}
echo "</table></div>";
$reporte = ob_get_clean();
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=consulta.xls");
header("Pragma: no-cache");
header("Expires: 0");
echo $reporte;
yo hago unos reportes con con un archivo RTF, Ahora esos reportes me los cambiaron por un archivo ecxel,
el excel viene con una formulario ya definido, entonces quería saber si el reporte nuevo en excel se puede hacer de una forma muy similar como construi el RTF DE Word, para no hacerlo como definí el primer código
agradezco sus opiniones y comentarios.
Valora esta pregunta


0