以下是引用mr725在2012-1-17的发言:
但是不管那一层,相邻的名称一样时都会合并掉:如 a_b,b_b两列会把第二层的b合并掉。这个要老大来看看了!
此主题相关图片如下:未命名25.jpg
![dvubb 图片点击可在新窗口打开查看](UploadFile/2012-1/201211623581226149.jpg)
在CZY版主基礎上稍作變通即可:
Dim t As Table = CurrentTable
Dim title,fl,s As String
title = "变态方法能加精吗 (:_"
fl = ProjectPath & "test.xls"
With t.DataTable
For Each c As Col In t.Cols
c.Caption = title & c.Caption & c.Index
Next
.BuildHeader()
t.SaveExcel(fl,t.Name)
Dim Bk As New XLS.Book(fl)
Dim Sht As XLS.Sheet = Bk.Sheets(0)
For Each c As Col In t.Cols
s = Sht(c.Caption.split("_").Length-1,c.index).Value
Sht(c.Caption.split("_").Length-1,c.index).Value = s.replace(cstr(c.index),"")
c.Caption = c.Caption.Replace(title,"").Replace(cstr(c.Index),"")
Next
.BuildHeader()
bk.Save(fl)
End With
[此贴子已经被作者于2012-1-17 16:41:11编辑过]