开发者

How to read .xlsx file contents in flex3

开发者 https://www.devze.com 2023-04-13 00:01 出处:网络
I need to know how to read .xlsx file contents in flex3. Does anyone comes across this problem please give some idea to accomplish this task. If any good API please let me know.

I need to know how to read .xlsx file contents in flex3. Does anyone comes across this problem please give some idea to accomplish this task. If any good API please let me know.

I tried to read .xlsx file using the below sample code but its not working, but its working fine for .xls file.

// on creation complete
private function onCreate(e:Event):void
{
var request:URLRequest = new URLRequest("C://test.xlsx");
var urlLoader:URLLoader = new URLLoader(request);
urlLoader.addEventListener(Event.COMPLETE, onURLLoaderComplete); 
urlLoader.dataFormat = URLLoaderDataFormat.BINARY; 
urlLoader.load(request);
}

// on file loa开发者_JAVA技巧d complete
private function onURLLoaderComplete(event:Event):void
{
        loadedFile = event.target.data;
    var excelFile:ExcelFile = new ExcelFile();
    excelFile.loadFromByteArray(loadedFile);
    sheet = excelFile.sheets[0]; 
    Alert.show(sheet.getCell(1,0).value) 
    DataGrid.dataProvider=sheet.values; 
}

Thanks in Advance.


If you only need cell values, save it as CSV - it is very simple to parse (unlike xlsx.)

0

精彩评论

暂无评论...
验证码 换一张
取 消