如何使用actionscript(AIR)读取excel(2007+ xlsx)工作表?
如何使用actionscript(AIR)读取excel(2007+ xlsx)工作表?
How to read excel(2007+ xlsx) sheet using actionscript(AIR)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
as3xls
用于读取和写入 Excel 文件的 Actionscript 3 库。目前支持从 Excel 2.0-2003 版本读取数字、文本和公式,以及将数字、文本和日期写入 Excel 2.0。不需要服务器端帮助。
支持信息
文档和示例位于 http://code.google.com/p/as3xls/
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/
我写了这个: https://github.com/childoftv/as3-xlsx-reader我很想知道是否有帮助
I wrote this: https://github.com/childoftv/as3-xlsx-reader I'd love to know if it helps
你知道这是如何...效率低下的吗?
Excel 对文件使用复杂的设置,除非您想为其电子表格编写一个全面的解析器(相信我,单独弄清楚格式字符的作用会很困难),否则您最好找到另一个解决方案。
毫不夸张地说,使用“保存到 XML”选项将使您的工作轻松数千倍。 AS3 没有对 Excel 的本机支持,因此没有任何实际意义。但它具有处理 XML 的出色集成方法。
如果可能,将 Excel 文件保存为 XML 并解析它们。
更好的是,使用数据库,并通过 PHP 将它们解析为 XML。
我进行了搜索并得出了以下结论: http://code.google.com/ p/php-excel-reader/
一旦您在 PHP 中获得了它,将其传递到 Flash 就完全没有问题了。我建议将其转换为对象的直接数组,并通过 Zend_Amf、AMFPHP 或 WebOrb(无论您最喜欢哪一种)将其转换为 AMF3。然后您可以创建表、操作数据或进行任何您喜欢的操作。它也比使用 XML 更快、更轻。
PK
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
我查看了 xlsx 细分,我花了 1 周的时间编写了一个可以进行基本格式化和公式的 xlsx 编写器。我只花了 1 个小时仔细浏览 xlsx 文件中的目录,您所要做的就是创建相同的目录结构...主要是剪切和粘贴一些字符串...然后将其压缩并命名为 xlsx。
我通过使用 7zip 手动制作 xlsx 文件来尝试这个理论。我下载了 childoftv 的阅读器,尽管我不需要该阅读器,但该软件包包含一些 zip/unzip 类,这对任何想要制作 xlsx 编写器的人来说都是有帮助的。
长话短说,设置并不复杂,只需有人从繁忙的日程中抽出一周的时间来完成即可。我需要这个功能,所以如果还没有人做到,那么我就必须这样做。希望我的搜索能找到比论坛更好的东西,那里的普遍共识是“太难了,放弃”。
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."