bcb2010下导入Excel表出错
我原来在BCB6.0下导入EXCEL都很好,可现在 在2010版下却有问题 ,
比如我要导出"abcdef",但到Excel表就变成了"abc"
请各位帮我看看是怎么回事
Variant Excel,Wb,ExcelBook,ExcelSheet,Sheet,ERange,EBorders;
AnsiString strRowTemp;
AnsiString strRange;
AnsiString ExcelFileName;
try
{
//开始启动EXCEL
Excel=Variant::CreateObject("Excel.Application");
}
catch(...) {
MessageBox(Handle,"没有EXCEL","错误",MB_OK|MB_ICONERROR);
return; //没有Excel
}
Excel.OlePropertySet("Visible",true);
ExcelBook=Excel.OlePropertyGet("workbooks");
ExcelSheet=ExcelBook.OleFunction("add");
ExcelBook=Excel.OlePropertyGet("ActiveWorkBook");
ExcelSheet=ExcelBook.OlePropertyGet("ActiveSheet");
ExcelSheet.OlePropertyGet("Cells", 1,3).OlePropertySet("Value",txt1->Text.c_str());
ExcelSheet.OlePropertyGet("Cells", 1,2).OlePropertySet("Value",txt2->Text.c_str());
ExcelSheet.OlePropertyGet("Cells", 1,3).OlePropertySet("Value",txt1->Text.w_str());
ExcelSheet.OlePropertyGet("Cells", 1,2).OlePropertySet("Value",txt2->Text.w_str());