Possible mismatch with UNICODE define and TCHAR in Workbook.cpp
C++ library for creating XLSX files for MS Excel 2007 and above.
Brought to you by:
oxod,
programmeralex
In lines 1007 through 1013, there appears to be a discrepancy, when _UNICODE is defined, szCurrency is a wchar_t, but then if UNICODE is defined at the same time, then the function "wcstombs" chokes on szCurrency because it is a wchar_t not char as it expects. It seems that it should actually use the "_stprintf" on line 1013 instead.
When I try to compile as is (with UNICODE and _UNICODE defined), I get the following error:
C:\Users\kelton_stefan\Documents\Projects\foresite_c3\software\pc\c3\SimpleXlsx\Xlsx\Workbook.cpp|1010|error: cannot convert 'TCHAR {aka wchar_t}' to 'char' for argument '1' to 'size_t wcstombs(char, const wchar_t*, size_t)'|
After changing "#ifdef UNICODE" on line 1009 to "#ifndef UNICODE", it compiles perfectly.
I'm compiling with MinGW 4.7.1. Am I missing something here, or is this an error in the code? Thanks much, you've done a great job on this library!
Sincerely,
Kelton
Hi!
This is a known issue, that the library is not ready to use with unicode indeed.
So far, I can only recommend to switch it off (may be locally).
Still, if you need a unicode version, take a look at Cells with russian text topic in forum, there are some links which might be helpful.
SimpleXlsx r0.20
Workbook.cpp, line1007~1015
Replace above with below
(more correctly i think)