如何将数据库导出为Word和Excel文件格式?都用表格的形式
有没有具体一点的代码?主要是数据字段如何放入Word表格中的代码?

解决方案 »

  1.   


    参考:
    http://www.csdn.net/develop/author/netauthor/lihonggen0/http://www.csdn.net/develop/read_article.asp?id=14952
    http://www.csdn.net/develop/read_article.asp?id=16987
      

  2.   

    象这样:
    将表中的内容导出到WORD                Dim wordApp As New Word.Application()                Dim myDoc As Word.Document                Dim oTable As Word.Table                 Dim rowIndex, colIndex As Integer                rowIndex = 1                colIndex = 0                 wordApp.Documents.Add()                myDoc = wordApp.ActiveDocument                oTable = myDoc.Tables.Add(Range:=myDoc.Range(Start:=0, End:=0), NumRows:=Table.Rows.Count + 1, NumColumns:=Table.Columns.Count)
      

  3.   

    如果数据源是vsflexgrid
    应该怎么样导出到word里啊?
      

  4.   

    一个道理,循环行、列,往WORD里的Tables里加
      

  5.   

    下面这段代码那里有错误啊?非常感谢Dim vs As New VSFlexGrid
    vs = frmmain.VSFlexGrid1
    Dim cell As VSFlexGridcell
    For Each cell In vs.Cells
        rowIndex = rowIndex + 1
        colIndex = colIndex + 1
        oTable.cell(rowIndex, colIndex).Range.InsertAfter (vs.cell(rowIndex, colIndex).Text)
    Nex