hi all, back again in the end of 2019
I do have some tips while you uploading xls file, the common xls files when the column consists a number, it will inform the ax that the field is a number, the bad side is, we have to format it to text in xls before upload it
but, a common user will never notice this and give the files to developer for upload the files, this is disaster for uploading so I do have some tricks here,
while you know that the columns is a string, even they input it as a number, you need to call ConvertToStr100 function
this source code below:
public str 100 ConvertToStr100(COMVariant value) { System.Double netDouble; anytype r1; str s1; COMVariantType valueType; s1 = value.bStr(); valueType = value.variantType(); if(valueType != COMVariantType::VT_BSTR) { switch(valueType) { case COMVariantType::VT_R8: r1 = value.double(); netDouble = Global::real2double(r1); s1 = netDouble.ToString(); break; } } return strFmt("%1", s1); }
if the ComVariantType wasnt string, then if the ComVariantType is Double then we convert Global::real2double and using ToString() to convert it to string
for example:
the origin excel cell was 2
but since the ComExcel assumed the cell is a number type, they will tell that the cell was not a string or function, it means number 2,
- if we convert it to string without real2double function, then the result is: “2.00”
- but if we using real2double function, the result is: “2”
*Happy learning*