老师,datamap只能和列绑定用么?我在做导入模板时也需要数据库的英文和Excel表列名的中文转换,不知可以不?
Dim nums1() As String={"cardID","name","sex"}
Dim nums2() As String={"身份证号", "姓名","性别"}
Dim nms As New List(of String)
For i As Integer = 0 To nums2.Length-1 '获取已经勾选的列
nms.Add(nums2(i))
Next
'生成Excel表
Dim dt As Table = Tables("person")
Dim Book As New XLS.Book
Dim Style As XLS.Style = Book.NewStyle() '定义新样式
Style.AlignHorz = XLS.AlignHorzEnum.Center
Style.AlignVert = XLS.AlignVertEnum.Center
Dim Sheet As XLS.Sheet = Book.Sheets(0)
For i As Integer = 0 To nms.count -1
Sheet(0, i).Value = nms(i)''获得该值在nums1中的位置,然后在nums2的同等位置找
Sheet(0, i).Style = Style
Next
'保存并打开excel文件
Book.Save("c:\reports\test.xls")
Dim Proc As New Process
Proc.File = "c:\reports\test.xls"
Proc.Start()
您看红色部分,我现在用这个方法,想用Datamap,不知可行不?
这个和列绑定的datamap又不一样,列绑定我理解的是:数据字典对列的取值有作用,,我这里其实是EXCEl表的表名需要时中文的,但是数据库里面他们是英文的?
麻烦老师了