我想在 as3xls 的帮助下从 xls 文件中获取数据。
private var file:FileReference = new FileReference();
private var sheet:Sheet;
private var loadedFile:ByteArray;
private function sendLogistImport():void {
file.addEventListener(Event.SELECT, onFileSelect);
file.browse();
file.addEventListener(Event.COMPLETE,
function (e:Event):void {
loadedFile = e.currentTarget.data as ByteArray;
var excelFile:ExcelFile = new ExcelFile();
excelFile.loadFromByteArray(loadedFile);
sheet = excelFile.sheets[0];
Alert.show(sheet.getCell(1,0).value);
}
);
}
private function onFileSelect(e:Event):void {
file.load();
}
但我在excelFile.loadFromByteArray(loadedFile); :
Error: Error #2030: End of file was encountered.
at flash.utils::ByteArray/readUTFBytes()
at com.as3xls.xls::ExcelFile/boundsheet()[/Users/manuelwudka-robles/Documents/Flex Builder 3/as3xls/com/as3xls/xls/ExcelFile.as:633]
at Function/http://adobe.com/AS3/2006/builtin::call()
at com.as3xls.xls::ExcelFile/loadFromByteArray()[/Users/manuelwudka-robles/Documents/Flex Builder 3/as3xls/com/as3xls/xls/ExcelFile.as:309]
at Function/<anonymous>()[D:\logist.as:244]
这是我的 xls 文件的屏幕截图:
这是我的 xls 文件: http ://www.filedropper.com/template_1
请告诉我,我的错误在哪里?