How to read a CELLTYPE_NUMBER type cell as a string by using the LibXL, so that the string is the same as what is displayed?

63 views Asked by At

The readStr function returns an empty string, and there are multiple types of numbers, such as NUMFORMAT_GENERAL, NUMFORMAT_NUMBER, NUMFORMAT_NUMBER_D2, NUMFORMAT_NUMBER_SEP, etc. I just want to get a string that looks the same as what is displayed.

The num may be display as: 1.1 1.11 1.111 1.025 $1.25 (4.25)

https://www.libxl.com/format.html

Thers is too many type.

switch (format->numFormat()) { case NUMFORMAT_GENERAL: case NUMFORMAT_NUMBER: str = format->formatNumber(value, -1); break; case NUMFORMAT_NUMBER_D2: str = format->formatNumber(value, 2); break; case NUMFORMAT_NUMBER_SEP: str = format->formatNumber(value, -1); str = str.replace(str.find_first_of(L'.'), 1, 1, L','); break; // other default: break; }

0

There are 0 answers