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

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...