Quantcast
Viewing latest article 17
Browse Latest Browse All 66

#12857: wxConvertOleToVariant converts a bad date

In wxConvertOleToVariant, the converted date is assigned to the variant before assigning the date. This results in a bad date always being returned.

The only workaround (which really isn't a real workaround) is to convert the excel sheet to specifically format the cell as text (I think - didn't test that).

This issue is in 2.8 only. The trunk behaves properly. The fix is very simple:

*** automtn.cpp.bck     Sun Jan 09 10:43:55 2011
--- automtn.cpp Sun Jan 09 10:44:15 2011
***************
*** 713,725 ****
              VariantTimeToSystemTime(oleVariant.date, &st);
              wxDateTime date;
-             variant = date;
              date.Set(st.wDay,
                       (wxDateTime::Month)(wxDateTime::Jan + st.wMonth - 1),
                       st.wYear,
                       st.wHour,
                       st.wMinute,
                       st.wSecond);
  #endif
              break;
          }
--- 713,725 ----
              VariantTimeToSystemTime(oleVariant.date, &st);
              wxDateTime date;
              date.Set(st.wDay,
                       (wxDateTime::Month)(wxDateTime::Jan + st.wMonth - 1),
                       st.wYear,
                       st.wHour,
                       st.wMinute,
                       st.wSecond);
+             variant = date;
  #endif
              break;
          }

Viewing latest article 17
Browse Latest Browse All 66

Trending Articles