之前匯的報表都沒問題嗎,一定也有這種狀況吧,
  煉鋼的鑄序 4/7,匯到excel會變 4月7日。

  MsExcelWorkSheet.Rows[1].NumberFormatLocal:='@';       //整列儲存格都設為文字格式
  MsExcelWorkSheet.Cells[1,1].NumberFormatLocal:='@';     //單一儲存格設為文字格式
 
---

  for Col:=0 to DBGrid15.FieldCount-1 do
  begin
   if Col=3 then
   begin
    MyWorkSheet.Cells[Row,4].NumberFormatLocal:='@';
    MyWorkSheet.Cells[Row,Col+1]:=DBGrid15.Fields[Col].AsString;
   end
   else
    MyWorkSheet.Cells[Row,Col+1]:=DBGrid15.Fields[Col].AsString;
  end;
 
 
文章標籤
全站熱搜
創作者介紹
創作者 Apple 的頭像
Apple

舊東西 新想念

Apple 發表在 痞客邦 留言(0) 人氣(1,228)