
Excel编程
风清扬_jd
专注搬砖
展开
-
VC编程实现运行Excel宏 Run
CApplication xlsAppLication;//初始化略CString macro = _T("macro");//excel文件中的宏名字例如:假如宏的名字是marco1 那么就传入macro = _T("macro1");xlsAppLication.Run(_variant_t(macro),vtMissing,vtMissing,vtMissing,vtMissing,vtMissing,vtMissing,vtMissing,vtMissing,vtMissing,vtM原创 2013-12-03 11:43:05 · 2773 阅读 · 0 评论 -
VC编程实现 excel插入一行单元格Insert
/*enum XlInsertFormatOrigin { xlFormatFromLeftOrAbove = 0,//向上插入行 xlFormatFromRightOrBelow = 1//向下插入行 }; */本例是以Excel2007为例CApplication xlsAppLication;//初始化ole还有excel略LPDISPATCH lpDisp = NULL; lpDisp = xlsAppLication.get_ActiveSheet(); CWork原创 2013-12-03 11:09:13 · 4245 阅读 · 1 评论 -
VC编程实现设置excel的光标样式put_Cursor
以Excel2007为例请自行根据不同版本的Excel库进行相应的更改/*enum XlMousePointer{ xlIBeam = 3, xlDefault = -4143, xlNorthwestArrow = 1, xlWait = 2};光标样式枚举*/XlMousePointer xlmouse;CApplication xlsAppLication;//初始化略xlsAppLication.put_Cursor(xlmouse);原创 2013-12-03 11:52:50 · 1488 阅读 · 0 评论 -
excel 如何绘制边框
//绘制外边框void XlsDrawOutBorders(const CString &Row, const CString &Col,XlBordersLineStyle xlLineStyle, XlBorderWeight XlsWeight,long coloIndex){ if (!xlsAppIsInit()) { return; } if (Row.IsEmpty(原创 2015-07-27 23:09:39 · 1963 阅读 · 1 评论 -
excel设置行高
//设置行高void XlsSetRowHeight(int Row, double height){ if (!xlsAppIsInit()) { return; } CRange range; LPDISPATCH lpDisp = NULL; /*得到工作簿中的Sheet的容器*/ lpDisp = m_xlsAppLication.get_ActiveSheet原创 2015-07-27 23:13:13 · 1711 阅读 · 0 评论 -
获得Excel一组单元格中的数据
//获得一组单元格中的数据 CString COperExcel::XlsGetRangeStrData(const CString &Row, const CString &Col){ if (!xlsAppIsInit()) { return _T("erro"); } if (Row.IsEmpty() || Col.IsEmpty()) { retu...原创 2018-07-22 23:26:10 · 345 阅读 · 0 评论 -
excel 设置单元格对齐方式
enum CellHorizonAlignment { xlCenter = -4108, xlLeft = -4131, xlRight = -4152, xlFill = 5, xlJustify= -4130, xlCenterAcrossSelection = 7, xlDistributed= -4117 }; enum CellVer...原创 2018-07-22 23:31:21 · 3399 阅读 · 1 评论 -
excel 单元格插入图片
//插入图片void COperExcel::XlsInsertPictrue(const CString &strPicPath,float xPos, float yPos,float picWidth, float picHeight){ if (!xlsAppIsInit()) { return; } if (strPicPath.IsEmpty()) { ...原创 2018-07-22 23:35:31 · 4113 阅读 · 0 评论