呼叫妖哥,2010下操作excel的代码到XE5下面不行了,似乎是传值时用AnsiString的c_str()不行了
以前因为以下语句不行:
ActiveSheet.EX_PG("Cells").EX_PG("Item",2,nFinalCol).EX_PS("Value","Test");
ActiveSheet.EX_PG("Cells").EX_PG("Item",2,nFinalCol).EX_PS("Value",asValue.c_str());
needBytes = WideCharToMultiByte(CP_ACP,0,pWideChar,-1, NULL,0, NULL, NULL);
pValue = new char[needBytes + 1];
ZeroMemory(pAnsi, needBytes + 1);
WideCharToMultiByte(CP_ACP, 0, pWideChar, -1, pAnsi,needBytes, NULL, NULL);
ActiveSheet.EX_PG("Cells").EX_PG("Item",2,nFinalCol).EX_PS("Value",pValue);