【发布时间】:2014-05-01 09:21:22
【问题描述】:
我的表是这样的
StudentId | Subjects | Marks
----------------------------
S001 | sub1 | 99
S002 | sub2 | 80
S003 | sub3 | 89
S004 | sub1 | 75
.
.
.
s100 | sub3 | 60
我需要在 excel 中生成一个输出。到目前为止,我知道如何使用 php pear 生成 Excel。现在的问题是如何获取这些值并将其传递给工作表。
我的代码,
while($records=mysql_fetch.....)
{
$sid[$records['StudentId']]=$records['StudentId'];
$sub[$records['Subjects']]=$records['Subjects'];
$mark[$records['Marks']]=$records['Marks'];
}
$row=2;
$col=0;
$worksheet->write($row,$col,?,$format);
...
...
我不知道要传递什么值?地方。 注意:没有任何操作。只需通过 $records 中获取的查询从表中获取值。现在需要像在表中一样打印输出。谁能帮帮我?
【问题讨论】:
-
除了我的代码,还有其他方法可以得到这个吗?谢谢提前
-
用php pear excel,你指的是
Spreadsheet_Excel_Writer包吗? -
@Bjoern..当然,我只使用 Spreadsheet_Excel_Writer。