引言
用友华表Cell控件在提供强大的报表功能的同时,在关键细节也是十分突出,为开发者进一步缩短开发周期和最终用
户的完美需求提供了有效有利的平台。下面的例子提供了VB语言对实现美观实用的下拉树形控件的解决方案。
正文
Cell 组件/插件提供了一组相关的方法,这些方法和事件的详细说明文档请参考帮助文件。
在 Cell 组件/插件中添加下拉树形控件分以下三个步骤:
1、设置XML类型字符串
Dim str As String
'设置XML
str = " "
str = str & "<:XML>"
2、设置图片(图片值设置为-1为不可见)
'设置树枝节点图片
Dim strPath1 As String
strPath1 = App.Path & "cell1.bmp"
Dim value1 As Long
value1 = Cell1.AddImage(strPath1)
'设置树叶节点图片
Dim strPath2 As String
strPath2 = App.Path & "cell2.bmp"
Dim value2 As Long
value2 = Cell1.AddImage(strPath2)
3、设置单元格中的下拉树形控件
Cell1.SetDroptreeCell 2, 2, 0, str, value1, value2, 0 '最后参数:单元格风格
1―单元格按钮在单元格未选中时不可见
备注:
设置单元格中的下拉树形控件。
[Visual Basic]
SetDroptreeCell(col As Long, row As Long, sheet As Long, xml As String,
nBranchImageIndex As Long, nLeafImageIndex As Long, option As Long)
参数
col
列号
row
行号
sheet
页号
xml
下拉树中的类容(xml格式)
nBranchImageIndex
树枝节点图片索引
nLeafImageIndex
树叶节点图片索引
option
单元格风格
4、运行截图
点击下载示例代码:如何在 Cell 组件插件中添加下拉树形控件.rar