|
#include <Excel.au3>
#include <Array.au3>
#include <File.au3>
$sFilePath1 = "D:\chenyuanlong\桌面\test\contacts.xls" ;This file should already exist
$oExcel = _ExcelBookOpen($sFilePath1)
$sFile = "D:\Test.txt"
;Show any errors that might occur when Opening the File
If @error = 1 Then
MsgBox(0, "Error!", "Unable to Create the Excel Object")
Exit
ElseIf @error = 2 Then
MsgBox(0, "Error!", "File does not exist - Shame on you!")
Exit
EndIf
$aArray = _ExcelReadSheetToArray($oExcel) ;Using Default Parameters
;将EXCEL文件读到数组
_FileWriteFromArray($sFile, $aArray, 0)
; 将数组内容写入TEST.TXT文件
_ArrayDisplay($aArray, "Array using Default Parameters")
;显示下数组内容
FileClose($sFile)
; Display results
Run("notepad.exe " & $sFile)
_ExcelBookClose($oExcel) ; 关闭打开的XLS文件
现在的问题是TEST.TXT里没有内容进去,数组内是有东西的! |
|