include_once('PHPExcel.php');
// Excel ファイルを読み込みます;
$PHPExcel = 新しい PHPExcel();
$PHPReader = 新しい PHPExcel_Reader_Excel5();
$PHPExcel = $PHPReader->load('/home/yuanjianjun/taobao_cat.xls');
$currentSheet = $PHPExcel->getSheet(0);
$allColumn = $currentSheet->getHighestColumn();
$allRow = $currentSheet->getHighestRow();
for($currentRow = 1; $currentRow
for($currentColumn='A'; $currentColumn
$アドレス = $currentColumn.$currentRow ;
echo $currentSheet->getCell($address)->getValue()."t";
}
エコー「n」;
}
// Excel ファイルを書き込む
$objExcel = 新しい PHPExcel();
$objWriter = 新しい PHPExcel_Writer_Excel5($objExcel);
$objProps = $objExcel->getProperties();
$objProps->setCreator("元");
$objProps->setLastModifiedBy("元");
$objProps->setTitle("エクセルテスト");
$objProps->setSubject("私の Excel テスト");
$objProps->setDescription("こんにちは。");
$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');
//Excel形式をコピー
$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.html