标签:
//定义变量
_Application ExcelApp;
Workbooks wbsMyBooks;
_Workbook wbMyBook;
Worksheets wssMysheets;
_Worksheet wsMysheet;
Range rgMyRge;
//创建Excel 服务器(启动Excel)
if (!ExcelApp.CreateDispatch("Excel.Application",NULL))
{
AfxMessageBox("创建Excel服务失败!");
exit(1);
}
ExcelApp.SetVisible(false);
//计算过程
。。。。。
//将EXCEL表格保存
rgMyRge.SetHorizontalAlignment(_variant_t((long)-4108));
strPath = path;
strPath += "\\ylhexcel.xls";
ExcelApp.SetVisible(true);
//释放对象
rgMyRge.ReleaseDispatch();
wsMysheet.ReleaseDispatch();
wssMysheets.ReleaseDispatch();
wbMyBook.ReleaseDispatch();
wbsMyBooks.ReleaseDispatch();
ExcelApp.ReleaseDispatch();
标签:
原文地址:http://www.cnblogs.com/lvdongjie/p/4614844.html