Monday, August 28, 2017

Get Excel cell value in common

anytype getExcelCellValue(int _row,
                          int _col)
{
    COMVariantType  comVariantType;
    SysExcelCells               cells;
    anyType retVal;
    ;
    comVariantType    = cells.item(_row, _col).value().variantType();
    switch (comVariantType)
    {
        case COMVariantType::VT_BSTR  :
            retVal = cells.item(_row, _col).value().bStr();
            break;
        case COMVariantType::VT_R8    :
            retVal = cells.item(_row, _col).value().double();
            break;
        case COMVariantType::VT_INT    :
            retVal = cells.item(_row, _col).value().int();
            break;
        case COMVariantType::VT_DATE  :
            retVal = cells.item(_row, _col).value().date();
            break;
        case COMVariantType::VT_EMPTY :
            retVal = cells.item(_row, _col).value().bStr();
            break;
        default :
            retVal = "";
            break;
    }
    return retVal;
}

No comments:

Post a Comment

Search hierarchy for a match (TableALLGroup) X++

  Table1 ppt;  select firstonly ppt  order ItemCode, ItemRelation, AccountCode, AccountRelation where      (ppt.ItemCode == TableGroupAll::T...