3,245
社区成员
发帖
与我相关
我的任务
分享
if(!hExcel.OpenBook(CA2W(strFileName.c_str()))){
CLog::Instance()->LOG_WriteLine(LOG_INFO_ERROR,
"%s: 打开文件(%s)失败",
__FUNCTION__, strFileName.c_str());
return false;
}
pWorkBook = hExcel.GetWorkBook();
if(hExcel.SetActiveSheet(L"Cycle")){
pSheet = hExcel.GetActiveSheet();
}
Excel::RangePtr RangeCell = pSheet->Cells;
//pSheet->Range["A3"][L"E13"];
const int nplot = 100;
const double xlow = 0.0, xhigh = 20.0;
double h = (xhigh - xlow) / (double)nplot;
_ChartPtr pChart = hExcel.GetWorkBook()->Charts->Add();
pChart->ChartWizard(
(Excel::Range*)RangeCell,
(long)Excel::xlXYScatter,
6L,
(long)Excel::xlColumns,
1L,1L,
true,
L"My Graph",
L"x",L"f(x)");
pChart->Name = L"My Data Plot";
hExcel.Save();
hExcel.Close();