23 Eylül 2009 Çarşamba

Axapta Excel import text formatted numeric values

While importing string values from MS Excel we use

SysExcelWorksheet.cells().item(8,j).value().bstr();

But, if cell value is numeric, Excel returns blank value.
So you have to control the value by a function below :

str valuestr(SysExcelCell _cell)
{
if (_cell.value().bStr())
return _cell.value().bStr();
else
{
if (_cell.value().double())
return strltrim(num2str(_cell.value().double(),20,0,0,0));
return "";

}

}

Hiç yorum yok: