我可以用xlsxwriter将=MAX(K2,L2,M2,O2,P2,Q2,N2)放入单元格F2中,这没有问题,但我无法为每行更改它(即:单元格F2中的=MAX(K2,L2,M2,O2,P2,Q2,N2))
因此,如果我有1000行,它将转到单元格F1000中的(即=MAX(K1000,L1000,M1000,O1000,P10002,Q2,N1000)(BestPrice是F行)
这是我在PHP 5.3.24中的代码
$resulted[$y] = array('ISBN' => $isbn,
'Quantity' => $qty,
'Title' => $shortTitle,
'ItemAmount'=>$amount,
'Best'=>$best,
'BestPrice'=> '=MAX(K2,L2,M2,O2,P2,Q2,N2)',
'Difference'=>'=E-H',
'AvaQty'=>$AvaQty,
'LastDate'=>$LastDate,
'LastPrice'=>$LastPrice,
);
$y++;
}
$header = array('ISBN' => 'integer',
'Quantity' => 'integer',
'Title' => 'string',
'Item_Amount'=>'price',
'Best' =>'string',
'BestPrice'=> 'price',
'Difference'=>'price',
'AvaQty'=>'integer',
'LastDate'=>'date',
'LastPrice'=>'price',
);
$col_options=array('widths'=> array(40, 10,40,10));
$writer = new XLSXWriter();
$writer->writeSheetHeader('Name', $header, $col_options);
foreach($resulted as $row)
$writer->writeSheetRow('Name', $row);
$writer->writeToFile("../My".$tracking .".xlsx");
有什么想法吗