时间:2021-07-01 10:21:17 帮助过:15人阅读
send('test.xls');//创建Worksheet$worksheet =& $workbook->addWorksheet('My first worksheet');//设置字体大小$format_column = & $workbook->addformat(array('Size'=>9,'Bold'=>1));//数据写入//标题行(第一行)$worksheet->write(0, 0, 'Name', $format_column);$worksheet->write(0, 1, 'Age', $format_column);//第一个人(第二行)$worksheet->write(1, 0, 'John Smith');$worksheet->write(1, 1, 30);//第二个人(第三行)$worksheet->write(2, 0, 'Johann Schmidt');$worksheet->write(2, 1, 31);//第三个人(第四行)$worksheet->write(3, 0, 'Juan Herrera');$worksheet->write(3, 1, 32);//关闭Workbook$workbook->close();?>
效果图:
当然,Spreadsheet_Excel_Writer的设置远远不止这些,详细介绍请参考:
http://pear.php.com/package/Spreadsheet_Excel_Writer/docs