求教:cb6中使用控件操作Excel的chart问题
void __fastcall TForm1::btn1Click(TObject *Sender)
{
ExcelApplication1->Connect();
ExcelApplication1->set_Visible(true,0);
ExcelWorkbook1->ConnectTo(
ExcelApplication1->Workbooks->Open(
WideString("F:\\Book1.xls"),
TNoParam(),TNoParam(),TNoParam(),
TNoParam(),TNoParam(),TNoParam(),TNoParam(),TNoParam(),TNoParam(),
TNoParam(),TNoParam(),TNoParam(),0));
ExcelWorksheet1->ConnectTo(ExcelWorkbook1->Worksheets->get_Item((Variant)2));
ExcelWorksheet1->Cells->set_Item((Variant)1,(Variant)1,(Variant)WideString("aaa"));
ExcelChart1->ConnectTo(ExcelWorksheet1->ChartObjects((Variant)1, (Variant)1));
//ExcelWorkbook1->Sheets->Add(TNoParam(), TNoParam(), 1, xlChart, 0);
ExcelWorksheet1->SaveAs(WideString("c:\\111.xls"));
ExcelApplication1->Disconnect();
ExcelApplication1->Quit();
}
环境cb6 + office 2007 ,编译通过,但运行到
ExcelChart1->ConnectTo(ExcelWorksheet1->ChartObjects((Variant)1, (Variant)1));
出错?
谁能帮忙看看,谢谢。
另外,有没有使用控件操作chart的例子,发个看看。
[解决办法]
libxl
不过需要破解
[解决办法]
难道是环境问题,不知我的代码有误吗?
[解决办法]
还有谁能指导下?
[解决办法]
该回复于2012-06-14 13:05:47被版主删除