You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can anybody tell me why the records with blanks on the datagrid show as zeros
instead of blanks? Thanks
{
CursorManager.setBusyCursor();
sheet = new Sheet();
var dataProviderCollection:ArrayCollection = excelgrid.dataProvider as ArrayCollection;
var rowCount:int = dataProviderCollection.length;
sheet.resize(rowCount + 1,excelgrid.columnCount);
var columns:Array = excelgrid.columns;
columns.splice(0, 1) // to delete the first column which is the number of each record , because this field has no datafield, the excel
//function does not work if we include it in the table like it is included now
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+1,sheet,record);
}
var xls:ExcelFile = new ExcelFile();
xls.sheets.addItem(sheet);
CursorManager.removeBusyCursor();
var bytes: ByteArray = xls.saveToByteArray();
var fr:FileReference = new FileReference();
fr.save(bytes,"DirectoryofForestProductsIndustries.xls");
}
else
{
Alert.show("Make sure your search produces any results before using this tool");
CursorManager.removeBusyCursor();
}
}
private function insertRecordInSheet(row:int,sheet:Sheet,record:Object):void
{
var colCount:int = excelgrid.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);
}
i++;
}
}
}
Original issue reported on code.google.com by [email protected] on 3 Dec 2012 at 3:52
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 3 Dec 2012 at 3:52The text was updated successfully, but these errors were encountered: