我正在尝试转换PHP页面中名为"Update2"的表的内容。
这是转换器:
header("Content-type: application");
header("Content-Disposition: attachment; filename=myfilename.xls");
这是代码分数:
<?php
$output_sql="select * from update2 where update_com_ag=1 order by update_fullname ASC";
$output_query=mysql_query($output_sql,$con);
while($output=mysql_fetch_array($output_query)){?>
<tr>
<td valign="top"><?php echo strtoupper($output['telephone_number']);?></td>
</tr>
<?php }?>
但是,假设电话号码1601000021056,excel文件中的输出将为1.601E + 12。有没有解决这个问题的解决方案?我已经尝试了几种方法,但仍然不起作用。
谢谢大家!!
转到 excel,突出显示电话号码列。右键单击并转到 单元格格式.转到"数字"选项卡。然后在左侧,您可以选择其他格式。就像小数点后 0 位的数字可能会做到这一点。
由于
空间限制,Excel 程序以该格式显示。增加列宽,它将正确显示数字。
在 excel 中,如果在值前面加上单引号,它会将该值视为字符串,即使它是一个数字。不确定它是否适用于您的导出方法,但值得一试。
<tr>
<td valign="top">'<?php echo strtoupper($output['telephone_number']);?></td>
</tr>