ATL development in Chart in Excel
来源:互联网 发布:fs2you for mac 编辑:程序博客网 时间:2024/06/05 17:20
ATL development in Chart in Excel
利 用Excel提供的类型库, 对Excel文档进行操作, 图表的开发是一项痛苦的工作, 一个图表是由多个series(系列)组成, 每个系列可以赋值不同的公式(formular). 本文对系列上显示的标记文本和背景的颜色改变作一点探讨, 由于是基于COM组件的ActiveX控件开发, 不同于用VBA脚本的开发, 相关内容在网上讨论几乎没有.我们已经创建一个chart在excel文档, 详见下面代码:SeriesCollection serc;serc=chart.SeriesCollection(vtMissing);Series ser=serc.NewSeries();Interior oInt = ser.GetInterior();oInt.SetColor(_variant_t((long)0)); // 注意, 这段代码会crash, 被注释掉//ser.SetMarkerBackgroundColor(RGB(0,0,0));LPDISPATCH lpdisp = wssMysheets.GetItem(_variant_t("Info"));_Worksheet sheet;sheet.AttachDispatch(lpdisp);str1.Format("I%d", i);str2.Format("=Info!I%d", i);lpdisp=sheet.GetRange(COleVariant(str1), COleVariant(str1));VARIANT var;var.vt = VT_DISPATCH; // .vt is the usable member of the tagVARIANTvar.pdispVal = lpdisp;ser.SetValues(var); // 关键代码... // 先适应数据标记ser.ApplyDataLabels(2, // Show valuevtMissing, vtMissing,vtMissing,vtMissing,vtMissing,_variant_t(true),vtMissing,vtMissing,vtMissing); // 得到缺省的数据标记DataLabels dls = ser.DataLabels(vtMissing); // 得到数据标记字体Font font = dls.GetFont(); // 对数据标记文本颜色修改!font.SetColor(_variant_t((long)RGB(255,255,255))); DataLabels有一个方法GetInterior(), 返回Interior对象, 调用其中的SetColor就可以改变标记文本的背景颜色.
- ATL development in Chart in Excel
- Excel Add-in Development in C/C++: Applications in Finance
- Financial Applications using Excel Add-in Development in C/C++
- How to create an Excel sheet or chart in VC?
- How to create an Excel sheet or chart in VC?
- MAP in ATL
- Tee Chart Usage in MFC
- Software Development in Unix Environment
- Code Inspection in Software Development
- Development in the ext environment
- Rapid Struts Development in JDeveloper
- Nagios plug-in development guidelines
- common words in software development
- common words in software development
- Disable NSLog in apple development
- Disable NSLog in apple development
- Eclipse Plug-in Development Tutorial
- Eclipse Plun-in development reference
- Windows群集开发-编写微软群集服务器(MSCS)资源DLL:3)微软群集服务器架构
- 读取并创建资源文件
- 关于get的几个函数
- SQL select 使用BETWEEN关键字
- 解决刷新页面造成的数据重复提交问题
- ATL development in Chart in Excel
- 清除系统垃圾的bat文件
- 用于模式匹配的RegExp方法
- Windows群集开发-编写微软群集服务器(MSCS)资源DLL:4)资源和资源DLL
- 让dropdownlist三级联动无刷新
- EXT 文件上传扩展组件简单介绍
- 备份网络数据
- DataBinder.Eval(Container.DataItem,"Name")和Container.DataItem("Name")有什么区别?
- 用CSS在表格中添加流动条