BCB创建一个EXCEL文档文件
仅仅是创建,不需要关心内容。。。
谢谢!
[解决办法]
我自己写了一段,不过没测试,应该是没问题的了
void __fastcall CreateExcelFile(AnsiString File)
{
Variant xls;
try
{
xls = Variant::CreateObject( "Excel.Application ");
}
catch(...)
{
MessageBox(NULL, "启动Excel出错 ", "错误 ",MB_ICONWARNING);
xls = Unassigned;
return;
}
xls.OlePropertySet( "Visible ",false);
xls.OlePropertyGet( "Workbooks ").OleFunction( "Add ",1);
xls.OlePropertyGet( "ActiveWorkbook ").OleFunction( "SaveAs ",File.c_str());
xls.OleFunction( "Quit ");
xls = Unassigned;
}