get2abhi / as3xls Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/as3xls
Automatically exported from code.google.com/p/as3xls
Hi guys.
First of all, ill download a swc library that is incorrect (not compiles
under Flex Builder 3).
So, i download the source and attach it to mine, but while in the datagrid
the correct value of cell is shown ok, when i capture this, and transfer to
another component like a textarea its always null
To fix this error, i browse to
in Class: Cell.as
At line , the method: get value()
The original says
var ret:*;
I solved that issue when:
var ret:Object;
Because, Adobe recommend all the cast to Object since Flash Player 10
The Same in the line 26, and all when "*" is used
Original issue reported on code.google.com by [email protected]
on 2 Nov 2009 at 4:46
Attachments:
What steps will reproduce the problem?
1.import excel file
2.read the imported sheet , unable to read
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 22 Nov 2010 at 8:08
What steps will reproduce the problem?
1. Create a new ExcelFile
2. Save it to disk
3. reload it
What is the expected output? What do you see instead?
when i reload a file create with the saveToByteArray, i have this issue :
warning: unable to bind to property 'sheets' on class
'libs.as3xls.xls::ExcelFile'
the current sheet on the line 602 of the Excelfile class is a null reference
Please use labels and text to provide additional information.
i create the ExcelFile like this :
var f:File = new File();
var fs:FileStream = new FileStream();
// Set up the Excel sheet and size it appropriately
var s:Sheet = new Sheet();
s.resize(10, 10);
// Loop over the input array and set each cell to the appropriate value
for(var r:uint = 0; r < s.rows; r++) {
for(var c:uint = 0; c < s.cols; c++) {
s.setCell(r,c,"test");
}
}
// Wrap the sheet in an Excel file and write it to disk
var xls:ExcelFile = new ExcelFile();
xls.sheets.addItem(s);
var ba:ByteArray = xls.saveToByteArray();
f.nativePath = path+"/dotation.xls";
fs.open(f, FileMode.WRITE);
fs.writeBytes(ba);
fs.close();
Original issue reported on code.google.com by [email protected]
on 12 Mar 2010 at 3:23
What steps will reproduce the problem?
1. download the example
2. save .xls
3. open with excel
What is the expected output? What do you see instead?
Expect = clean sheet. Instead = many jargled characters all over the place
What version of the product are you using? On what operating system?
What ever version is down-loadable today
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 9 Nov 2010 at 4:43
[code]
import com.as3xls.xls.Sheet;
var sheet:Sheet = new Sheet();
[/code]
Error: Could not find resource bundle collections
at mx.resources::ResourceBundle$/getResourceBundle()
at mx.collections::ListCollectionView$cinit()
at global$init()
at global$init()
at com.as3xls.xls::Sheet()
at example_fla::MainTimeline/frame1()
Using flash CS4
No coment!
Original issue reported on code.google.com by [email protected]
on 7 Jul 2010 at 8:39
What steps will reproduce the problem?
1. open an excel file and create a cell with this value 40025.64539621528
2. apply on excel a date formatter using localized format (the formatter
shows an asterisk before the formatter in excel, see picture attached)
3. use getCell on the cell.
What is the expected output? What do you see instead?
The code in sheet.as that analyzes and tries to guess the cell formatter
fails detecting date and returns the number version, also forcing the date
detection fails due to the +1 in the "d.date += cellValue +1" code row.
What version of the product are you using? On what operating system?
Latest (from download section) Mac and Windows, i've checked on the svn and
the code is the same.
Please provide any additional information below.
I had to do copy and paste from the cell.as area and also remove the "+1"
from the d.date += cellvalue to let the code work flawlessy, otherwise it
was wrong regarding the day (it was some days forward).
var d:Date = new Date();
d.hours = 0;
d.minutes = 0;
d.seconds = 0;
d.milliseconds = 0;
d.fullYear = 1899;
d.month = 11;
d.date = 30;
d.date += cellValue; //removed +1
Original issue reported on code.google.com by [email protected]
on 9 Aug 2009 at 6:54
Attachments:
What steps will reproduce the problem?
1. Create a new sheet
2. Create a new cell sheet.setCell(0, 0, "=1+10");
What is the expected output? What do you see instead?
I would expect to see the value 11 in that cell, but instead i am left with the
string =1+10
Please provide any additional information below.
Can you please tell me how i can achieve this, or if you have plans to support
this? Am very keen to
get this to work, happy to implement myself, if you can offer me a couple of
pointers.
Original issue reported on code.google.com by [email protected]
on 27 May 2009 at 5:10
What steps will reproduce the problem?
1. I use with flex sdk version 4.1 and player 10.1.
2. I try to browse and select a xls file.
3. I saw an error about 1009 error
What is the expected output? What do you see instead?
TypeError: Error #1009: null 객체 참조의 속성이나 메서드에
액세스할 수 없습니다.
at com.as3xls.xls::ExcelFile/dimensions()[D:\project\hanjun\flex\SampleFlex4\src\excel\com\as3xls\xls\ExcelFile.as:619]
at Function/http://adobe.com/AS3/2006/builtin::call()
at com.as3xls.xls::ExcelFile/loadFromByteArray()[D:\project\hanjun\flex\SampleFlex4\src\excel\com\as3xls\xls\ExcelFile.as:309]
at ExcelDownload/fileReference_Complete()[D:\project\hanjun\flex\SampleFlex4\src\excel\ExcelDownload.mxml:61]
What version of the product are you using? On what operating system?
Windows XP Proffesional
Please provide any additional information below.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.as3xls.xls.Cell;
import mx.collections.ArrayCollection;
import com.as3xls.xls.Sheet;
import com.as3xls.xls.ExcelFile;
import mx.controls.dataGridClasses.DataGridColumn;
private var fileReference:FileReference;
private var sheet:Sheet;
[Bindable]
private var fields:Array = new Array();
private var ItemDGDataProvider:ArrayCollection = new ArrayCollection([
{name:"Item1",value:"21",qty:"3",cost:"12.21"},
{name:"Item2",value:"20",qty:"4",cost:"12.22"},
{name:"Item3",value:"22",qty:"5",cost:"12.23"},
{name:"Item4",value:"23",qty:"2",cost:"12.24"}
]);
[Bindable]
private var rebateDGDataProvider:ArrayCollection = new ArrayCollection();
private function browseAndUpload():void
{
fileReference = new FileReference();
fileReference.addEventListener(Event.SELECT,fileReference_Select);
fileReference.addEventListener(Event.CANCEL,fileReference_Cancel);
fileReference.browse();
}
private function fileReference_Select(event:Event):void
{
fileReference.addEventListener(Event.COMPLETE,fileReference_Complete);
fileReference.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
fileReference.load();
}
private function fileReference_Cancel(event:Event):void
{
fileReference = null;
}
private function onLoadError():void
{
/*body not implemented*/
}
private function fileReference_Complete(event:Event):void
{
var fileData:ByteArray = fileReference.data;
var excelFile:ExcelFile = new ExcelFile();
var noOfRows:int;
var noOfColumns:int;
if(fileData!=null && fileData.length > 0){
excelFile.loadFromByteArray(fileData);
var sheet:Sheet = excelFile.sheets[0];
if(sheet!=null)
{
noOfRows=sheet.rows;
noOfColumns = sheet.cols;
for(var row:int = 0; row<noOfRows;row++)
{
var cellObject:Object ={};
for(var col:int=0;col<noOfColumns;col++)
{
var cell:Cell = new Cell();
var cellValue:String = new String();
cell = sheet.getCell(row,col);
if(cell!=null)
{
cellValue =(cell.value).toString();
addProperty(cellObject,col,cellValue);
}
}// inner for loop ends
rebateDGDataProvider.addItem(cellObject);
} //for loop ends
} //if sheet
} //if filedata
rebateScheduleDG.includeInLayout = true;
rebateScheduleDG.visible = true;
fileReference = null;
}
private function addProperty(cellObject:Object,index:int,cellValue:String):void
{
if(index == 0)
cellObject.cost = cellValue;
else if(index == 1)
cellObject.name = cellValue;
else if(index == 2)
cellObject.qty = cellValue;
else if(index == 3)
cellObject.value = cellValue;
}
private function exportToExcel():void
{
sheet = new Sheet();
var dataProviderCollection:ArrayCollection = rebateByItemDG.dataProvider as ArrayCollection;
var rowCount:int = dataProviderCollection.length;
sheet.resize(rowCount+4,10);
sheet.setCell(0,0,"Item Name");
sheet.setCell(0,1,"Item Cost");
sheet.setCell(0,2,"Item Qty");
sheet.setCell(0,3,"Item Price");
var columns:Array = rebateByItemDG.columns;
var i:int = 0;
for each (var field:DataGridColumn in columns){
fields.push(field.dataField.toString());
sheet.setCell(0,i,field.dataField.toString());
i++;
}
for(var r:int=0;r<rowCount;r++)
{
var record:Object = dataProviderCollection.getItemAt(r);
/*insert record starting from row no 2 else
headers will be overwritten*/
insertRecordInSheet(r+2,sheet,record);
}
var xls:ExcelFile = new ExcelFile();
xls.sheets.addItem(sheet);
var bytes: ByteArray = xls.saveToByteArray();
var fr:FileReference = new FileReference();
fr.save(bytes,"SampleExport.xls");
}
private function insertRecordInSheet(row:int,sheet:Sheet, record:Object):void
{
var colCount:int = rebateByItemDG.columnCount;
for(var c:int; c < colCount; c++)
{
var i:int = 0;
for each(var field:String in fields){
for each (var value:String in record){
if (record[field].toString() == value)
sheet.setCell(row,i,value);
} // if
i++;
} // for record
} // for fields
} // for colCount
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:Button label="Browse" click="browseAndUpload()"/>
<mx:DataGrid id="rebateScheduleDG"
dataProvider="{rebateDGDataProvider}" width="100%"/>
<mx:DataGrid id="rebateByItemDG"
dataProvider="{ItemDGDataProvider}" width="100%" editable="true"/>
<s:Button label="Export To Excel" click="exportToExcel();"/>
</s:Application>
Original issue reported on code.google.com by [email protected]
on 16 Dec 2010 at 12:48
hi,i'm rafael,i'm a brazilian student,so my english isnt very well,lets go.
I found this project and think it's very good,a need this to make a
project to university,but a don't know how to do,i donwloaded the sample
code ExcelViewer and tried to run that application,but when i click in
export and choose the plan nothing happens,just the progress bar stay
working but nothing happens,anybody can help me?
like a step by step that i need to do to this working.
thanks very much...pls reply to me on
[email protected]
Original issue reported on code.google.com by [email protected]
on 27 Nov 2009 at 1:24
i want to download the source code of this component but i am not able to
download it ..
Refer SVN URL
http://as3xls.googlecode.com/svn/trunk/as3xls-read-only
Original issue reported on code.google.com by [email protected]
on 12 Jan 2011 at 11:51
What steps will reproduce the problem?
1. Load any xls into a Flex application with AS3XLS
2. Generate a new xls with the datas previously imported and save it to the
disk
3. Load the xls created at step 2 into a Flex application with AS3XLS
What is the expected output?
I expect the xls generated by AS3XLS to be correctly loaded with AS3XLS
What do you see instead?
I see nothing and get this error:
TypeError: Error #1010: Un terme n'est pas défini et n'a pas de propriété.
at com.as3xls.xls::ExcelFile/label()
("Un terme n'est pas défini et n'a pas de propriété" means "a term is
undefined and has no properties")
The debugger's break line is :
var fmt:String = s.formats[s.xformats[indexToXF].format];
in label() method in ExcelFile.as
Note :
- Loading the xls generated by AS3XLS into Excel works fine.
- Saving the xls generated by AS3XLS after having open it with Excel let it
to be correctly loaded with AS3XLS (Excel seems to re-format it correctly
when saving).
Original issue reported on code.google.com by [email protected]
on 27 May 2009 at 7:50
when i am exporting the xls file, the cell is unable to accommodate the text of
length more then 255.
Please give me the solution to fit large text data in to the cell.
Original issue reported on code.google.com by [email protected]
on 9 May 2011 at 2:31
Not sure just what causes this but evaluating
"=PI()*SIN(-375)+COS(99)-TAN(-1+2)+ATAN(SIN(5))"
on my system produces a number that's 16 significant digits, but the test case
only uses 15. The
attached patch sets the precision for both sides of the assertEquals to 15
significant digits.
Original issue reported on code.google.com by [email protected]
on 22 Feb 2008 at 3:42
Attachments:
What steps will reproduce the problem?
1. Load Eaxcel file with some rows, or add some rows
2. do Sheet.resize()
Expected - existing rows will not deleted
Instead - they're deleted
Version - 1.0 Jan 2008
Additional information:
This bug is built in the code of Sheet.resize(), in the lines:
// Add needed columns
for(var row:uint = 0; row < _values.length; row++) {
for(var col:uint = 0; col < _cols; col++) {
_values[row][col] = new Cell();
_values[row][col].dateMode = _dateMode;
}
}
row and col should start from old _rows and _cols values, instead of zero.
Original issue reported on code.google.com by [email protected]
on 14 Oct 2009 at 2:56
I change saveToByteArray to saveToByteArray(charset:String ="cn-gb")
and attach svn patch
Original issue reported on code.google.com by [email protected]
on 5 Dec 2008 at 1:23
Attachments:
What steps will reproduce the problem?
1. Open File in ExcelViewer
2. Debug player shows EOF error
3. No Data shown
What is the expected output? What do you see instead?
I have a Date column and a Formatted Number column. It gets everything as
Number, and there is no way to figure out what the particular cell's type
is, or if it has any formatting applied to it.
What version of the product are you using? On what operating system?
Flex 3 on WinXP
Please provide any additional information below.
Also does not process Time type field.
Original issue reported on code.google.com by [email protected]
on 18 Jun 2009 at 4:56
Attachments:
What steps will reproduce the problem?
1. Try to import a .xlsm file from your local desktop.
2. While this loadFromByteArray() method is executed, I am not able to convert
the byteArray data into ExcelFile data.
Please help me out...
3.
What is the expected output? What do you see instead?
It should load successfully
Please use labels and text to provide additional information.
Original issue reported on code.google.com by [email protected]
on 25 Apr 2011 at 6:22
Hi,
i couldn't send the same ByteArray used to show Excel data in the Datagrid
to .Net page.....!
Original issue reported on code.google.com by [email protected]
on 3 Jun 2009 at 9:08
What steps will reproduce the problem?
1. When i use setCell() letters like "ç á é í ó ú ê ã õ" in Excel are
show how #$ or another characters before save it's printing correctly
2.
3.
What is the expected output? What do you see instead?
The expected output is this ç á é í ó ú ê ã õ
Please use labels and text to provide additional information.
Original issue reported on code.google.com by vbdalmaz
on 15 Mar 2011 at 4:37
What steps will reproduce the problem?
1. Open xls with cells which are derived by formula
2. Set sheet as dataprovider for DataGrid
3. Set editable=true for DataGrid
4. Click on cell which is derived by formula
5. Click on other cells (usually 3 times)
6. Previous cell values disappear
What is the expected output? What do you see instead?
Expected: Cells change only by text input, Shown: Cell values disappear
What version of the product are you using? On what operating system?
Office 2003 xls with SUM, AVG formulas with Flex SDK 3.2
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 12 Feb 2009 at 2:02
What steps will reproduce the problem?
1. Read excel file with formulas with 'INT()'
2. ROUNDDOWN(sth,sth), ROUNDUP(sth,sth) functions
3. Issue with SUM of many cells
Please provide any additional information below.
First I would like to thank for this library, great work , it saved me a
lot of time :).
I have found however some few small bugs and I also found the solution for
them.
1. In excels that I had to load the formulas with INT function did not
work properly. That is because the Excel INT function always returns
Intiger value of the input rounded down.
In .as file the Math.round(rest[0]) function is used which gives faulty
results. To correct it just change the line 161 in
com/as3xls/formula/formula.as file to 'return Math.floor(rest[0]);'
2. In my input excels in formulas I had ROUNDDOWN & ROUNDUP funcions which
were not supported by as3xls. I did some research in excel file
specification (e.g. http://sc.openoffice.org/excelfileformat.pdf ) and
found the function codes and inputs ('212' and '213').
To add the functions those following files have to be modified:
com/as3xls/xls/formula/Functions.as :
- additional elements in the tables 'names' and 'args' (file in attach)
com/as3xls/xls/formula/Formula.as
- two additional case alements in 'builtInFunction' function:
e.g.:
case 212: // ROUNDUP
return Math.ceil(rest[0]);
case 213: // ROUNDDOWN
return Math.floor(rest[0]);
I needed only rounding to INT value so I don't use second argument from
Excel input.
I guess this issue can be helpful if you have to add any other missing
formulas.
3. I got a wrong result value with following example formula:
"=(D7/(D4+D5+D6+D7+D8))" ,
quick fix to "=(D7/SUM(D4:D8))" gave the right value.
I don't know what caused the error, if someone have time them mybe can
investigate it. :)
BR
Rafal
Original issue reported on code.google.com by [email protected]
on 17 May 2010 at 12:18
Attachments:
What steps will reproduce the problem?
1. Create a file using as3xls
2. Try to send file with MS Outlook
What is the expected output? What do you see instead?
Expect file to send. Instead, Outlook does nothing.
Original issue reported on code.google.com by [email protected]
on 4 Aug 2009 at 6:33
What steps will reproduce the problem?
1. When I browse a file from my desktop and try to load it using
loadFromByteArray method I get this error
What is the expected output? What do you see instead?
It is load the excel file properly
Please use labels and text to provide additional information.
Getting this error: A script has executed for longer than the default time
period of 15 seconds
Original issue reported on code.google.com by [email protected]
on 17 Mar 2011 at 7:18
What steps will reproduce the problem?
1. Use the provided example to create a new excel sheet, then save it as a
file stream, use PHP to send the bytestream as a xsl file to MS office
excel -- WORKS
2. attempt to repeat opening with Openoffice.org calc -- FAILS.
What is the expected output? What do you see instead?
Expected open office calc to be able to open xls files as it always does
with all other excel files but not ones generated from as3xls. Open office
thinks it's a tab delimited file instead of a true excel spreadsheet. There
will be garbage before and after fields imported.
What version of the product are you using? On what operating system?
as3xls 1.0, windows vista, Open office calc 3.0m9
Please provide any additional information below.
Switching encoding doesn't seem to fix this issue. But the same site works
as documented for excel applications.
Original issue reported on code.google.com by [email protected]
on 13 Aug 2009 at 1:28
The "Run" and "view source" links for the examples are broken.
Tried with Chrome4 and IE8
Where can I find them?
thanks a lot!
Gert
Original issue reported on code.google.com by [email protected]
on 24 Feb 2010 at 12:41
What steps will reproduce the problem?
1. Try to export some data containing Asian characters with as3xls
2. Launch the resulted xls file
3. Show the "???" instead of the Asian characters
Thanks by advance for your help.
A French man.
Original issue reported on code.google.com by [email protected]
on 22 Mar 2011 at 3:05
I couldn’t use this Excel viewer in my work environment that consist of (
web server and file server),
My logic is simple:
• Web server contains the Flex project (files).
• File server contains the .xls files.
When I run the flex project I load the excel data and pass the data as
ByteArray to (xls.loadFromByteArray).
The problem is that when the its asked my for user name/password then the
IE crash. Could you help me on this?
Original issue reported on code.google.com by [email protected]
on 6 Jun 2009 at 11:35
What steps will reproduce the problem?
1. import attached xls file
2. read value from sheets[0].getCell(0,3)
What is the expected output? What do you see instead?
Should display numeric value called from sheet2, but instead reads null
Please provide any additional information below.
It appears that formulas referencing other sheets are set as Record.type =
1052, which has handler function "format" rather than "formula".
Original issue reported on code.google.com by [email protected]
on 23 Feb 2009 at 6:10
Attachments:
What steps will reproduce the problem?
1. Upload an excel file (created on mac or win) from either safari or firefox
2.
3.
What is the expected output? What do you see instead?
Expect to see the file contents, with worksheet info, but nothing is displayed.
Same files on
windows loads just fine.
What version of the product are you using? On what operating system?
OSX Leopard 10.5.2
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 12 Aug 2008 at 5:26
Attachments:
Attached patch reworks the date tests so that they work outside of GMT-0800.
Cause I'm in GMT-
0500 and I'm sure there are others in other zones :)
Original issue reported on code.google.com by [email protected]
on 22 Feb 2008 at 3:11
Attachments:
Hello There,
I want to create an xls file which will contain different styles for
different cells.. Just like "to do 2007.xls" in samples directory.
Any one help me on how to achieve this task ?
Original issue reported on code.google.com by mutyam.srinivas
on 3 Feb 2010 at 10:34
What steps will reproduce the problem?
1. Create new Excel file and add 2 or more sheets to it:
var excelFile:ExcelFile = new ExcelFile();
var sheet1:Sheet = new Sheet();
sheet1.resize(10,10);
sheet1.setCell(0,0,"Blah");
excelFile.sheets.addItem(sheet1);
var sheet2:Sheet = new Sheet();
sheet2.resize(10,10);
sheet2.setCell(0,0,"Whatever");
excelFile.sheets.addItem(sheet2);
2. Save the Excel file to a byte array and save as an .xls file:
var byteArray:ByteArray = excelFile.saveToByteArray();
Var fileRef:FileReference = new FileReference();
fileRef.save(byteArray,"test.xls");
3. Open the new .xls file in Excel.
What is the expected output? What do you see instead?
Expect to see an Excel spreadsheet with 2 sheets. See an Excel spreadsheet
with one sheet (with first cell containing "Blah");
What version of the product are you using? On what operating system?
Version of as3xls.swc downloaded on March 26 2009.
Adobe Flex Bulder version 3.0
Flash Player version 10.0.22
Windows Server 2003 version 5.2 R2
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 30 Mar 2009 at 5:15
What steps will reproduce the problem?
1. Click on the View Source or Run link in the Project Home page next to
any one of the sample.
What is the expected output? What do you see instead?
To run the demo or sample.
Please provide any additional information below.
Clicking on the Samples like gives a Page Not found Error.
Not Found
The requested URL /ExcelViewer/ was not found on this server.
Apache/2.0.54 Server at as3xls.mwudka.com Port 80
Original issue reported on code.google.com by [email protected]
on 9 Apr 2010 at 8:41
What steps will reproduce the problem?
1.
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 9 Aug 2010 at 5:31
What steps will reproduce the problem?
1. I try to save a xls file as the same name that exist file name.
2. I saw player error.
3.
What is the expected output? What do you see instead?
Error #2044: 처리되지 않은 IOErrorEvent입니다. text=Error #2038:
파일 I/O 오류입니다.
at ExcelDownload/exportToExcel()[D:\project\hanjun\flex\SampleFlex4\src\excel\ExcelDownload.mxml:134]
at ExcelDownload/___ExcelDownload_Button2_click()[D:\project\hanjun\flex\SampleFlex4\src\excel\ExcelDownload.mxml:166]
What version of the product are you using? On what operating system?
flex sdk 4.1, player 10.1
Please provide any additional information below.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.as3xls.xls.Cell;
import mx.collections.ArrayCollection;
import com.as3xls.xls.Sheet;
import com.as3xls.xls.ExcelFile;
import mx.controls.dataGridClasses.DataGridColumn;
private var fileReference:FileReference;
private var sheet:Sheet;
[Bindable]
private var fields:Array = new Array();
private var ItemDGDataProvider:ArrayCollection = new ArrayCollection([
{name:"Item1",value:"21",qty:"3",cost:"12.21"},
{name:"Item2",value:"20",qty:"4",cost:"12.22"},
{name:"Item3",value:"22",qty:"5",cost:"12.23"},
{name:"Item4",value:"23",qty:"2",cost:"12.24"}
]);
[Bindable]
private var rebateDGDataProvider:ArrayCollection = new ArrayCollection();
private function browseAndUpload():void
{
fileReference = new FileReference();
fileReference.addEventListener(Event.SELECT,fileReference_Select);
fileReference.addEventListener(Event.CANCEL,fileReference_Cancel);
fileReference.browse();
}
private function fileReference_Select(event:Event):void
{
fileReference.addEventListener(Event.COMPLETE,fileReference_Complete);
fileReference.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
fileReference.load();
}
private function fileReference_Cancel(event:Event):void
{
fileReference = null;
}
private function onLoadError():void
{
/*body not implemented*/
}
private function fileReference_Complete(event:Event):void
{
var fileData:ByteArray = fileReference.data;
var excelFile:ExcelFile = new ExcelFile();
var noOfRows:int;
var noOfColumns:int;
if(fileData!=null && fileData.length > 0){
excelFile.loadFromByteArray(fileData);
if(excelFile.sheets.length>0)
{
var sheet:Sheet = excelFile.sheets[0];
if(sheet!=null)
{
noOfRows=sheet.rows;
noOfColumns = sheet.cols;
for(var row:int = 0; row<noOfRows;row++)
{
var cellObject:Object ={};
for(var col:int=0;col<noOfColumns;col++)
{
var cell:Cell = new Cell();
var cellValue:String = new String();
cell = sheet.getCell(row,col);
if(cell!=null)
{
cellValue =(cell.value).toString();
addProperty(cellObject,col,cellValue);
}
}// inner for loop ends
rebateDGDataProvider.addItem(cellObject);
} //for loop ends
} //if sheet
}
} //if filedata
rebateScheduleDG.includeInLayout = true;
rebateScheduleDG.visible = true;
fileReference = null;
}
private function addProperty(cellObject:Object,index:int,cellValue:String):void
{
if(index == 0)
cellObject.cost = cellValue;
else if(index == 1)
cellObject.name = cellValue;
else if(index == 2)
cellObject.qty = cellValue;
else if(index == 3)
cellObject.value = cellValue;
}
private function exportToExcel():void
{
sheet = new Sheet();
var dataProviderCollection:ArrayCollection = rebateByItemDG.dataProvider as ArrayCollection;
var rowCount:int = dataProviderCollection.length;
sheet.resize(rowCount+4,10);
sheet.setCell(0,0,"Item Name");
sheet.setCell(0,1,"Item Cost");
sheet.setCell(0,2,"Item Qty");
sheet.setCell(0,3,"Item Price");
var columns:Array = rebateByItemDG.columns;
var i:int = 0;
for each (var field:DataGridColumn in columns){
fields.push(field.dataField.toString());
sheet.setCell(0,i,field.dataField.toString());
i++;
}
for(var r:int=0;r<rowCount;r++)
{
var record:Object = dataProviderCollection.getItemAt(r);
/*insert record starting from row no 2 else
headers will be overwritten*/
insertRecordInSheet(r+2,sheet,record);
}
var xls:ExcelFile = new ExcelFile();
xls.sheets.addItem(sheet);
var bytes: ByteArray = xls.saveToByteArray();
var fr:FileReference = new FileReference();
fr.save(bytes,"SampleExport.xls");
}
private function insertRecordInSheet(row:int,sheet:Sheet, record:Object):void
{
var colCount:int = rebateByItemDG.columnCount;
for(var c:int; c < colCount; c++)
{
var i:int = 0;
for each(var field:String in fields){
for each (var value:String in record){
if (record[field].toString() == value)
sheet.setCell(row,i,value);
} // if
i++;
} // for record
} // for fields
} // for colCount
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:Button label="Browse" click="browseAndUpload()"/>
<mx:DataGrid id="rebateScheduleDG"
dataProvider="{rebateDGDataProvider}" width="100%"/>
<mx:DataGrid id="rebateByItemDG"
dataProvider="{ItemDGDataProvider}" width="100%" editable="true"/>
<s:Button label="Export To Excel" click="exportToExcel();"/>
</s:Application>
Original issue reported on code.google.com by [email protected]
on 16 Dec 2010 at 1:21
What steps will reproduce the problem?
1. Use as3xls to export a excel file.
2. try importing it useing as3xls.
3.
What is the expected output? What do you see instead?
the target file must be imported, but it shows some null point error in
as3xls dimension().
What version of the product are you using? On what operating system?
latest version, WinXP.
Please provide any additional information below.
after exporting i opened the file using excel and saved it again. now i
tried importing the file i saved newly its importing correctly, but it
comes with a added column with empty values !!!!!!
Original issue reported on code.google.com by [email protected]
on 21 May 2010 at 7:05
[deleted issue]
What steps will reproduce the problem?
1. Run ExcelViewer (http://as3xls.mwudka.com/ExcelViewer/)
2. Load file "file.xls"
What is the expected output? What do you see instead?
An error appears : "ExcelViewer_bug_endoffile.JPG" (Error: Error #2030: Fin
de fichier détectée...)
What version of the product are you using? On what operating system?
Flash Player 9,0,124,0
Please provide any additional information below.
The error appears also when I try to compile the project with Flex builder 3.
Original issue reported on code.google.com by [email protected]
on 15 Oct 2008 at 11:43
Attachments:
What steps will reproduce the problem?
1. Load Excel Sheet with Arabic Headers through URLLoader
2. Save the data in Array Collection
3. Assign Data to Any data control [Data Grid,ADG , Chart]
What is the expected output? What do you see instead?
The arabic font don't display correctly even if the unicode range is
specified(font is embeded).The Arabic character inserted through
resourseBundle are displaying correctly.
eg: in stylesheet
@font-face{
/*font-family : localfont;*/
/* src: local("Arabic Typesetting"); */
src: url("assets/fonts/ARIAL.TTF");
fontFamily: "Arial";
advancedAntiAliasing: true;
unicode-range:
U+00A0-U+00FF,
U+0020-U+003E,
U+0152-U+0178,
U+2002-U+20AC,
U+0192-U+0390,
U+0391-U+03D6,
U+2022-U+2044,
U+2118-U+2135,
U+2190-U+21D4,
U+2200-U+22C5,
U+2308-U+232A,
U+25CA-U+2666,
U+00A1-U+00FF,
U+2000-U+206F,
U+20A0-U+20CF,
U+2100-U+2183,
U+0020-U+007E,/* Punctuation, Numbers U/L-Case A-Z Symbols */
U+00B2-U+00B9,/* SUPERSCRIPT*/
U+2070-U+2089,/* SUBSCRIPT*/
U+0600-U+06FF,/* Arabic */
U+FB50-U+FDFF,/* Arabic */
U+FE70-U+FEFF;/* Arabic */
}
Please use labels and text to provide additional information.
Original issue reported on code.google.com by [email protected]
on 1 Jun 2009 at 3:39
Attachments:
What steps will reproduce the problem?
1. Create an data grid with cells that have numbers that start with 0
eg 079797
2. Export to Excel trying to set the cell.format value to 'text'
3. This seem to apply to all format values.
What is the expected output? What do you see instead?
Expected a cell with 079797 and its format set to 'Text'
Actual Result: The cell in Excel is of the 'General' format and the initial 0 is lost.
What version of the product are you using? On what operating system?
Flex 3.5
WinXP
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 13 Sep 2010 at 1:04
When click on link of RUN/View, its take me to some irrelevant page..
Original issue reported on code.google.com by [email protected]
on 27 Sep 2010 at 11:55
Attachments:
What steps will reproduce the problem?
1. when i upload excel file it shows the error
2. The supplied index is out of bounds.
3. here the sheetList.selectedIndex = 0
What is the expected output? What do you see instead?
I need to get the entries in flex datagrid but i've the error as
'RangeError: Error #2006: The supplied index is out of bounds.'
What version of the product are you using? On what operating system?
Windows XP Flex Builder 3.2
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 18 Nov 2009 at 12:02
What steps will reproduce the problem?
1. Go to project home.
2. Try to do to any demo. Or to any source link.
3. Failure/
What is the expected output? What do you see instead?
Soemthing to see.
What version of the product are you using? On what operating system?
Version on home page on Jan 15 2010.
Please provide any additional information below.
ExcelOrCsvViewer missing. Others missing.
Original issue reported on code.google.com by [email protected]
on 15 Jan 2010 at 8:11
What steps will reproduce the problem?
1. Load an Excel file with one sheet.PSA ExcelSheet Attached
2. call excelFile.loadFromByteArray(byteArray) where excelFile is
instance of ExcelFile.as
3. The function loadStream(startSecID:uint of CDFReader gives error at
>>>>>stream.readBytes(ret, offset, sectorSize);
What is the expected output? What do you see instead?
expected : The file should be load normally.
see instead:
The Flex application crashes in IE 7.0 and in Firefox it gives out of
memory error.
What version of the product are you using? On what operating system?
Flex 3.0, Windows XP
Please provide any additional information below.
PSA BugExcelFile.xls
Original issue reported on code.google.com by [email protected]
on 5 Jun 2009 at 7:42
Attachments:
What steps will reproduce the problem?
1.
var excelFile:ExcelFile = new ExcelFile();
excelFile.loadFromByteArray(new xls());
sheet = excelFile.sheets[0];
var data: Number = sheet.getCell(2, 2).value;
2.
3.
What is the expected output? What do you see instead?
I am expecting a number 0.365, however it gave me 0.37.
What version of the product are you using? On what operating system?
dpUInt_b_v09_2_Flex_3.swc. Windows XP
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 10 Dec 2009 at 4:56
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.