回复 11# joint
你從頭到尾 沒有引用函數 怎麼會存檔................
_ArrayDisplay 只是秀資料 沒其他用途 別想用它來做任何事情....
看看我的語法 再比對一下自己的語法
#include <Array.au3>
Local $array[1000][8]
For $i = 0 To 100
For $j = 0 To 7
$array[$i][$j] = "Item " & StringFormat("%02i", $i) & StringFormat("%02i", $j)
Next
Next
_ArrayDisplay($array)
_SaveToCsv ($array,@ScriptDir&"yd.csv")
MsgBox(0,"存檔成功","檔案位於:"&@ScriptDir&"yd.csv")
Func _SaveToCsv($aArray, $sCsvSavePath)
Local $csv = FileOpen($sCsvSavePath, 2 + 8)
If UBound($aArray, 0) = 1 Then
For $i = 0 To UBound($aArray) - 1
Local $sStr = '"' & StringReplace($aArray[$i][$j], '"', '""') & '"'
FileWriteLine($csv, $sStr)
Next
ElseIf UBound($aArray, 0) = 2 Then
For $i = 0 To UBound($aArray, 1) - 1
Local $sStr = ''
For $j = 0 To UBound($aArray, 2) - 1
$sStr &= '"' & StringReplace($aArray[$i][$j], '"', '""') & '",'
Next
$sStr = StringTrimRight($sStr, 1)
FileWriteLine($csv, $sStr)
Next
EndIf
FileClose($csv)
EndFunc ;==>_SaveToCsv
|