文章介绍了关于phpexcel读写xls文件的方法代码,有需要了解的同学可以参考一下本教程哦。
代码如下 复制代码
load('/home/yuanjianjun/taobao_cat.xls');
$currentsheet = $phpexcel->getsheet(0);
$allcolumn = $currentsheet->gethighestcolumn();
$allrow = $currentsheet->gethighestrow();
for($currentrow = 1; $currentrow for($currentcolumn='a'; $currentcolumn $address = $currentcolumn.$currentrow;
echo $currentsheet->getcell($address)->getvalue().t;
}
echo n;
}
//write excel file
$objexcel = new phpexcel();
$objwriter = new phpexcel_writer_excel5($objexcel);
$objprops = $objexcel->getproperties();
$objprops->setcreator(yuan);
$objprops->setlastmodifiedby(yuan);
$objprops->settitle(excel test);
$objprops->setsubject(my excel test);
$objprops->setdescription(hello world.);
$objprops->setkeywords(phpexcel);
$objprops->setcategory(excel);
$objexcel->setactivesheetindex(0);
$objactsheet = $objexcel->getactivesheet();
$objactsheet->settitle('test1');
$objactsheet->setcellvalue('a1', '字符串内容');
$objactsheet->setcellvalue('a2', 26);
$objactsheet->setcellvalue('a3', true);
$objactsheet->setcellvalue('a4', '=a2+a2');
$objwriter->save('/home/yuanjianjun/helloworld.xls');
//copy excel format
$objreader = phpexcel_iofactory::createreader('excel5');
$objphpexcel = $objreader->load('/home/yuanjianjun/20100301.xls');
$objwriter = phpexcel_iofactory::createwriter($objphpexcel, 'excel5');
$objwriter->_phpexcel->setactivesheetindex(0);
$objwriter->_phpexcel->getactivesheet()->setcellvalue('a1', 'fesdf');
$objwriter->_phpexcel->getactivesheet()->setcellvalue('b1', 's');
$objwriter->_phpexcel->getactivesheet()->setcellvalue('c1', 'fefsd');
$objwriter->_phpexcel->getactivesheet()->setcellvalue('d1', 'sdfd');
$objwriter->_phpexcel->getactivesheet()->setcellvalue('e1', '淘宝cps');
$objwriter->save('/home/yuanjianjun/copy.xls');
http://www.bkjia.com/phpjc/631615.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/631615.htmltecharticle文章介绍了关于phpexcel读写xls文件的方法代码,有需要了解的同学可以参考一下本教程哦。 代码如下 复制代码 ?php include_once('phpexcel.php');...