基本信息
源码名称:MFC操作Excel
源码大小:0.03M
文件格式:.rar
开发语言:C/C++
更新时间:2021-07-30
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍


【核心
const char *excel_name="d:\\test1.xls";

void CexcelkongzhiDlg::OnBnClickedButton1()
{
	// TODO: 在此添加控件通知处理程序代码
	IllusionExcelFile op;
	
	if (op.InitExcel() == FALSE)
	{
		MessageBox(_T("初始化失败"));
	}
	op.ShowInExcel(FALSE);


	if (op.OpenExcelFile(excel_name) == FALSE)
	{
		MessageBox(_T("打开文件失败"));
		op.CloseExcelFile();
	}
	
	//GetSheetCount
	//m_int = op.GetSheetCount();//获取sheet的数量
	
	m_sheet_name= op.GetSheetName(1);//获取sheet的名称
	

	const char *sheet2 = "Sheet1";

	if (op.LoadSheet(sheet2) == FALSE)
	{
		MessageBox(_T("加载失败"));
		exit;
	}
	//m_int = op.GetColumnCount();

	m_int = op.GetCellDouble(2,1);


	if (op.IsCellInt(2,1) == TRUE)
	{
		MessageBox(_T("是数字"));
	}

	if (op.IsCellString(2,1) == TRUE)
	{
		MessageBox(_T("是字符"));
	}
	UpdateData(FALSE);

	op.SetCellInt(1,7,123);
	//CString str = _T("d:\\test1.xls");
	op.SaveasXSLFile(op.GetOpenFileNameW());
	MessageBox(_T("保存"));
	op.CloseExcelFile();

}
代码】