|
|
|
อยากเช็ด column excel ให้รับค่าเปน text เมื่อ export ออกมาจาก php |
|
|
|
|
|
|
|
require_once '../Classes/PHPExcel.php';
$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A1', 'CardNumber')
->setCellValue('B1', 'Tran_AMount')
->setCellValue('C1', 'TerminalID')
->setCellValue('D1', 'Date time')
->setCellValue('E1', 'settleDate')
->setCellValue('F1', 'Approve code')
->setCellValue('G1', 'ResponCode')
->setCellValue('H1', 'Tran type');
$objQuery = mysql_query($strSQL);
$i = 2;
while($objResult = mysql_fetch_array($objQuery))
{
$objPHPExcel->getActiveSheet()->setCellValue('A' . $i, $objResult["CardNumber"]);
$objPHPExcel->getActiveSheet()->setCellValue('B' . $i, $objResult["Tran_AMount"]);
$objPHPExcel->getActiveSheet()->setCellValue('C' . $i, $objResult["TerminalID"]);
$objPHPExcel->getActiveSheet()->setCellValue('D' . $i, $objResult["Date_time"]);
$objPHPExcel->getActiveSheet()->setCellValue('E' . $i, $objResult["settleDate"]);
$objPHPExcel->getActiveSheet()->setCellValue('F' . $i, $objResult["Approve_code"]);
$objPHPExcel->getActiveSheet()->setCellValue('G' . $i, $objResult["ResponCode"]);
$objPHPExcel->getActiveSheet()->setCellValue('H' . $i, $objResult["tranx_type"]);
$i++;
Tag : PHP, Excel (Excel.Application)
|
|
|
|
|
|
Date :
2015-07-15 14:59:49 |
By :
biltzbock |
View :
997 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
น่าจะคำสั่งนี้หน่ะครับ
Code (PHP)
$objPHPExcel->getActiveSheet()->setCellValue('A' . $i, $objResult["CardNumber"], PHPExcel_Cell_DataType::TYPE_STRING);
|
|
|
|
|
Date :
2015-07-15 15:40:13 |
By :
WiTT |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|