How to read excel(2007+ xlsx) sheet using actionsc

2019-06-11 01:19发布

How to read excel(2007+ xlsx) sheet using actionscript(AIR)?

4条回答
干净又极端
2楼-- · 2019-06-11 01:37

as3xls

An Actionscript 3 library for reading and writing Excel files. Currently reading numbers, text, and formulas from Excel version 2.0-2003 and writing numbers, text, and dates to Excel 2.0 is supported. No server-side help is needed.

SUPPORT INFORMATION Documentation and samples are at http://code.google.com/p/as3xls/

查看更多
forever°为你锁心
3楼-- · 2019-06-11 01:38

Do you have any idea how... Inefficient this is?

Excel uses a complex setup for files, and unless you want to write a full-scale parser for its spreadsheets (which, believe me, will be difficult, alone to figure out what the format chars do), you'd be better off finding another solution.

Say, using a "save to XML" option would make your job a few thousand times easier, without exaggeration. AS3 has no native support for Excel, there is no real point for it to have such. But it has great integrated methods for working with XML.

If possible, save the Excel files to XML and parse those.

Better still, use databases, and parse them as XML through PHP.

I did a search and came up with this: http://code.google.com/p/php-excel-reader/

Once you've got it in PHP, passing it on to Flash is no problem at all. I'd recommend turning it into straight arrays of objects and converting it to AMF3 via Zend_Amf, AMFPHP or WebOrb, whichever one you're most comfortable with. You can then create tables, manipulate the data or whatever you like. It'd also be a lot faster and lighter than using XML.

PK

查看更多
Melony?
4楼-- · 2019-06-11 01:52

I wrote this: https://github.com/childoftv/as3-xlsx-reader I'd love to know if it helps

查看更多
Summer. ? 凉城
5楼-- · 2019-06-11 01:52

I took a look at the xlsx breakdown and it would take me 1 week to write an xlsx writer that could do basic formatting and formulas. I've only spent 1 hour perusing through the directories in an xlsx file and all you'd have to do is create the same directory structure...mostly cut and paste some strings..and then zip it and call it xlsx.

I tried this theory by manually making an xlsx file using 7zip. I downloaded childoftv's reader and, though I don't need the reader, the package includes a few zip/unzip classes that would prove helpful for anyone who wants to make a xlsx writer.

Long story short, the setup isn't complex, somebody just has to take a week out of their busy schedule to do it. I need this functionality so if nobody's done it yet, then I'll have to. Hopefully my search will find something better than a forum where the general consensus is "it's too hard, give up."

查看更多
登录 后发表回答