经过大神修改过的as3xls支持中文,并可以修改保存单一sheet,保存后原有的excel样式均会消失,目前仅能如此。

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
creationComplete="windowedapplication1_creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import com.as3xls.xls.ExcelFile;
import com.as3xls.xls.Sheet; import mx.events.FlexEvent; private var _mbytes:ByteArray;
private var _excelFile:ExcelFile;
private var _sheet:Sheet;
private var _xls:ExcelFile;
protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
{
var file:File = new File("E:/AS/Examples/ReadExcel/src/样表.xls");
//读取文件
var stream:FileStream = new FileStream();
stream.open(file,FileMode.READ);
var ba:ByteArray = new ByteArray();
stream.readBytes(ba);
stream.close(); _xls = new ExcelFile();
_xls.loadFromByteArray(ba);
var sheet:Sheet = _xls.sheets[1];
var rows:int = sheet.rows;
trace(rows);
trace(sheet.getCell(0,0));
//修改表值
for(var i:int = 1;i<rows;i++){
sheet.setCell(i,3,Math.floor(Math.random()*2000).toString());
}
}
private function saveData():void
{
//写文件
_mbytes = _xls.saveToByteArray(1,"GB2312");//目前只能保存单个sheet数据
var file:File = File.desktopDirectory.resolvePath("data.xls");
var fs:FileStream = new FileStream();
fs.open(file, flash.filesystem.FileMode.WRITE);
fs.writeBytes(_mbytes);
fs.close();
} protected function saveBtn_clickHandler(event:MouseEvent):void
{
saveData();
} ]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<s:Button id="saveBtn" label="保存" left="10" top="10" click="saveBtn_clickHandler(event)"> </s:Button>
</s:WindowedApplication>

[Flex] as3xls读取excel,修改保存单表(一)的更多相关文章

  1. [Flex] as3xls读取excel,修改保存单表(二)

    这个方法仅用了as3xls读取excel的功能,修改保存独立出来了. <?xml version="1.0" encoding="utf-8"?> ...

  2. 读取Excel数据到Table表中

    方法一: try { List<DBUtility.CommandInfo> list = new List<DBUtility.CommandInfo>(); string ...

  3. ABAP 读取EXCEL文件到内表

    1.选择excel文件: PARAMETERS: P_FILE LIKE RLGRAP-FILENAME OBLIGATORY. AT SELECTION-SCREEN ON VALUE-REQUES ...

  4. Sqlserver 读取EXCEL

    1.1 启用本地读取设置 --启用EXEC sp_configure 'show advanced options', 1RECONFIGUREEXEC sp_configure 'Ad Hoc Di ...

  5. sql2008读取excel

    环境:win7(64位)+sql2008 sql语句: --启用Ad Hoc Distributed Queries: reconfigure reconfigure --使用完成后,关闭Ad Hoc ...

  6. C#中Form窗体中读取EXCEL的数据

    使用OLEDB可以对excel文件进行读取,我们只要把该excel文件作为数据源即可 首先引用Microsoft.EXEL 代码如下: using System; using System.Colle ...

  7. php读取excel文件 更新修改excel

    php读取excel文件示例,还有更新修改功能. 代码: //模板存放目录 $dir = $DOCUMENT_ROOT.'/backoffice/admin/oemcheck/'; $template ...

  8. C#读取Excel表中的数据时,为何有些行的字段内容读取不到

    转载:http://bbs.csdn.net/topics/360220285 1.当某列数据中含有混合类型时,在.NET中使用Microsoft.Jet.OLEDB.4.0来读取Excel文件造成数 ...

  9. 【转】Python xlrd、xlwt、xlutils读取、修改Excel文件

    Python xlrd.xlwt.xlutils读取.修改Excel文件 一.xlrd读取excel 这里介绍一个不错的包xlrs,可以工作在任何平台.这也就意味着你可以在Linux下读取Excel文 ...

随机推荐

  1. lambda 的使用汇总

    d=lambda x:x+1print(d(10))lambda 相当于一个轻量函数返回 d=lambda x:x+1 if x>0 else "error"print(d( ...

  2. CSS命名规则

    头:header  内容:content/container  尾:footer  导航:nav  侧栏:sidebar 栏目:column  页面外围控制整体布局宽度:wrapper  左右中:le ...

  3. Object-c-数组的使用

    一.数组: 1.数组初始化: a.NSArray *array = [[NSArray alloc] init]; b.NSArray *array = [[NSArray array]; 2.初始化 ...

  4. windows证书地址

    C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys 用certutil -sto ...

  5. HackerRank "Kundu and Tree" !!

    Learnt from here: http://www.cnblogs.com/lautsie/p/3798165.html Idea is: we union all pure black edg ...

  6. Some thoughts on a progress

    I can feel that I am making great progress now.. if inspected closely, it is obvious that what I'm g ...

  7. python学习-day01

    一.python介绍: python是一种面向对象的解释型计算机程序设计语言,由荷兰人Guido van Rossum于1989年发明,第一个公开发行版发行于1991年. Python语法简洁清晰,特 ...

  8. Linux后台开发常用工具

    内存分析工具valgrind valgrind辅助工具qcachegrind 可视化查看valgrind结果 淘宝DBA团队发布的监控脚本,使用perl开发,可以完成对linux系统和MySql相关指 ...

  9. IOS Bugs5 linker command failed with exit code 1 (use -v to see invocation)

    Ld /Users/Rubert/Library/Developer/Xcode/DerivedData/OC_Language-emftyzftyvhdpuaxipddjmpnpvox/Build/ ...

  10. Synchronizing with Remote Repositories

    Synchronizing the states of local and remote repositories consists of pulling from and pushing to th ...