Hola que tal, estoy haciendo reportes en word desde php, en este reporte incluyo una imagen, el problema está en que si descargo el documento en word generado al disco duro y al abrirlo no aparece la imagen, pero si en vez de descargarlo lo visualizo en el navegador la imagen ahi aparece, ¿como puedo hacer para que tambien aparezca en el archivo que descargo al disco duro?
Espero me puedan ayudar...
Pongo el código para que sea mas entendible
Código PHP:
<?php
//header("Content-type: application/vnd.ms-excel");
//header("Content-Disposition: attachment; filename=excel.xls");
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: filename=\"X2003.doc\";");
// … pasos de conexióna la BD y demás
include ("../conect/conec.php");
$link = conectar();
global $link;
//Logo
$logo = "cdi_small.png";
//$date = date("d/m/Y");
//$time = date("H:m:s");
$elabora = strtoupper($_GET['elabora']);
$fechaInicial = $_GET['fechaI'];
$fechaFinal = $_GET['fechaF'];
$dd = substr($fechaInicial,0,2);
$mm = substr($fechaInicial,3,2);
$aa = substr($fechaInicial,6,4);
$fechaInicial = $aa."-".$mm."-".$dd;
$dd = substr($fechaFinal,0,2);
$mm = substr($fechaFinal,3,2);
$aa = substr($fechaFinal,6,4);
$fechaFinal = $aa."-".$mm."-".$dd;
?>
<style type="text/css">
<!--
.Estilo1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
}
.Estilo3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; }
-->
</style>
<table width="655" border="0">
<tr>
<td width="155" rowspan="3"><img src="cdi_small.png" width="164" height="74"></td>
<td width="328"><div align="center"><span class="Estilo1">COMISION NACIONAL PARA EL DESARROLLO</span></div></td>
<td colspan="3"><div align="center"><span class="Estilo1">FECHA DE ELABORACION</span></div></td>
</tr>
<tr>
<td><div align="center"><span class="Estilo1">DE LOS PUEBLOS INDÍGENAS DELEGACIÓN</span></div></td>
<td width="50"><div align="center"><span class="Estilo1">DIA</span></div></td>
<td width="50"><div align="center"><span class="Estilo1">MES</span></div></td>
<td width="50"><div align="center"><span class="Estilo1">AÑO</span></div></td>
</tr>
<tr>
<td height="21"><div align="center"><span class="Estilo1">ESTATAL OAXACA CLAVE 2001</span></div></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td height="21"> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="28" colspan="5"><div align="justify"><span class="Estilo1">RELACION DE ARTICULOS QUE SE PROPONEN PARA ADQUISICIÓN POR INVITACIÓN RESTRINGIDA A POR LO MENOS TRES PROVEEDORES</span></div></td>
</tr>
</table>
<table width="661" border="0">
<tr>
<td width="100" bgcolor="#CCCCCC"><span class="Estilo3">No. PROGR.</span></td>
<td width="129" bgcolor="#CCCCCC"><span class="Estilo3">DESCRIPCION</span></td>
<td width="66" bgcolor="#CCCCCC"><span class="Estilo3">UNIDAD</span></td>
<td width="170" bgcolor="#CCCCCC"><span class="Estilo3">CANTIDAD</span></td>
<td width="87" bgcolor="#CCCCCC"><span class="Estilo3">PRECIO UNITARIO</span></td>
<td width="83" bgcolor="#CCCCCC"><span class="Estilo3">IMPORTE</span></td>
</tr>
<?php
$sql_productos = "select pedido.producto, sum(pedido.cantidad), producto.descripcion,producto.unidad from pedido,producto where pedido.fecha BETWEEN '".$fechaInicial."' AND '".$fechaFinal."' and pedido.producto = producto.clave_producto group by producto.descripcion";
$result_productos=mysql_query($sql_productos,$link);
$i=1;
$a=0;
$suma = 0;
while($row_productos = mysql_fetch_array($result_productos)){
$sql_precio="select max(precio_producto) from detalle_adquisicion where folio_nota = (select max(folio_nota) from detalle_adquisicion where clave_producto = '".$row_productos['producto']."') and clave_producto = '".$row_productos['producto']."'";
$result_precio=mysql_query($sql_precio,$link);
$row_precio = mysql_fetch_array($result_precio);
?>
<tr>
<td align="left"><span class="Estilo3"><?php echo $i;?></td>
<td align="left"><span class="Estilo3"><?php echo $row_productos['descripcion'] ?></span></td>
<td align="left"><span class="Estilo3"><?php echo $row_productos['unidad'] ?></span></td>
<td align="left"><span class="Estilo3"><?php echo $row_productos['sum(pedido.cantidad)'] ?></span></td>
<td align="left"><span class="Estilo3"><?php echo $row_precio['max(precio_producto)'] ?></span></td>
<td align="left"><span class="Estilo3"><?php echo $row_productos['sum(pedido.cantidad)'] * $row_precio['max(precio_producto)'] ?></span></td>
</tr>
<?
$i++;
}
?>
</table>