在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
phpexcel下载:https://github.com/PHPOffice/PHPExcel <?php /** *获取excel所有的批注 * * 存在编码问题,xls和xlsx的批注编码不同,建议使用xlsx文件格式 */ /** Include PHPExcel_IOFactory */ require_once dirname(__FILE__) . '/Classes/PHPExcel/IOFactory.php'; $inputFileName = "file.xlsx"; if (!file_exists($inputFileName)) { exit("not found $inputFileName." . EOL); } $inputFileType = PHPExcel_IOFactory::identify($inputFileName); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($inputFileName); // 获取所有批注 $objSheel = $objPHPExcel->getSheet(); $comments = $objSheel->getComments();//所有的批注 foreach ($comments as $pCellCoordinate => $comment) { $cell_value = $objSheel->getCell($pCellCoordinate)->getValue(); $comment_value = $comment->getText()->getPlainText(); // $cell_value = iconv('gbk', 'utf-8', $cell_value); // $comment_value = iconv('gbk', 'utf-8', $comment_value); var_dump($cell_value); var_dump($comment_value); }
|
2022-07-18
2022-08-16
2022-11-06
2022-08-18
2022-08-15
请发表评论