showbright1 / as3xls

Automatically exported from code.google.com/p/as3xls
0 stars 0 forks source link

MultiByte charset can't support #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I change saveToByteArray to saveToByteArray(charset:String ="cn-gb")
and attach svn patch

Original issue reported on code.google.com by usanac...@gmail.com on 5 Dec 2008 at 1:23

Attachments:

GoogleCodeExporter commented 8 years ago
I made the following change to Record.as to correctly read unicoded string

public function readUnicodeStr16():String {
    var len:uint = _data.readUnsignedShort();
    var opts:uint = _data.readByte();
    var compressed:Boolean = (opts & 0x01) == 0;
    var asianPhonetic:Boolean = (opts & 0x04) == 0x04;
    var richtext:Boolean = (opts & 0x08) == 0x08;

    var ret:String = "";
    if (!compressed) {
        for (var i:uint = 0; i < len; ++i) {
            if (_data.bytesAvailable < 2) break;
            var lbyte:uint = _data.readByte();
            var hbyte:uint = _data.readByte();
            ret += String.fromCharCode(hbyte * 256 + lbyte);
        }
    } else {
        len = len > _data.bytesAvailable ? _data.bytesAvailable : len;
        ret = _data.readUTFBytes(len);
    }

    return ret;
}

Original comment by po.my...@gmail.com on 27 Dec 2008 at 4:52

GoogleCodeExporter commented 8 years ago
This should read:
                    var lbyte:uint = _data.readUnsignedByte();
                    var hbyte:uint = _data.readUnsignedByte();

Original comment by ropo...@gmail.com on 2 Jun 2009 at 1:17

GoogleCodeExporter commented 8 years ago
While I was applying the patch I am getting that error: ExcelFile.as(file does 
not 
exist). How can I apply this patch?

Original comment by senaykor...@gmail.com on 3 Apr 2010 at 7:58

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
This:
    var lbyte:uint = _data.readByte();
        var hbyte:uint = _data.readByte();
        ret += String.fromCharCode(hbyte * 256 + lbyte);
Should be replaced with :
    ret += String.fromCharCode(ba.readUnsignedShort());

Original comment by nkhojay...@gmail.com on 20 Jun 2010 at 10:35

GoogleCodeExporter commented 8 years ago
this:
          for (var i:uint = 0; i < len; ++i) {
            if (_data.bytesAvailable < 2) break;
            var lbyte:uint = _data.readByte();
            var hbyte:uint = _data.readByte();
            ret += String.fromCharCode(hbyte * 256 + lbyte);
        }

Should be replaced with
              _data.readMultiByte(len * 2, "unicode");

Original comment by nkhojay...@gmail.com on 21 Jun 2010 at 8:11

GoogleCodeExporter commented 8 years ago
I've applied your patch to saveToByteArray and call it from AS3 code 
saveToByteArray("ISO_8859-7") for writing Greek. Did not worked (Excel does not 
display the greek characters on the 2nd line). AS3 code:

sheet = new Sheet();
sheet.resize(10, 10);
sheet.setCell(0, 0, "row1:");
sheet.setCell(0, 1, "στή2:");        // greek characters 
sheet.setCell(0, 2, "row3:");
var xls:ExcelFile = new ExcelFile();
xls.sheets.addItem(sheet);
var bytes:ByteArray = xls.saveToByteArray("ISO_8859-7");
var file:FileReference = new FileReference();
file.save(bytes, "greek.xls"); 

DO not know whether or not FileReference does the damage. Any ideas?

Original comment by aivarewo...@gmail.com on 10 Sep 2012 at 2:31

GoogleCodeExporter commented 8 years ago
I am not able to add chinese characters in the excel file generated using 
AS3XLS. My AS3 code is:
sheet.setCell(0, 1, "补补");

In Excel file 补补 is getting replaced with some garbage value (补补).

Any ideas how to resolve this?

Original comment by hemantka...@gmail.com on 1 Nov 2012 at 11:48

GoogleCodeExporter commented 8 years ago
how can i do patch to swc

Original comment by reza.air...@gmail.com on 4 Dec 2012 at 9:10