我用纯foxtable做了一个,大家看看有什么问题没有:
dim nm,nm1 as string
Dim tb as Table = currenttable
with tb
Dim dtb As New DataTableBuilder("ls")
For Each cl As Col In tb.Cols
If cl.Visible Then
if cl.index >= .leftcol and cl.index <= .rightcol
dtb.AddDef(cl.name, GetType(String), 32)
nm = nm & cl.name & ","
End If
End If
Next
dtb.Build()
Tables("ls").addnew(.bottomrow-.toprow+1)
end with
with tb
dim r as integer = .toprow
dim l as integer = .leftcol
for i as integer = .toprow to .bottomrow
for c as integer = .leftcol to .rightcol
If tb.cols(c).Visible Then
tables("ls").rows(i-r)(.cols(c).name)= tb(i,c)
end if
next
next
end with
MainTable= Tables("ls")
tables("ls").Select(0,0,tables("ls").count-1,tables("ls").cols.count-1)
Application.DoEvents
tables("ls").focus
Syscmd.Edit.Copy()
Application.DoEvents
'DataTables.Delete("ls") '***可以选择删除临时表,
但速度慢:要1~2秒钟···· 作为练习了~