如题,比较急,大家帮看一下。

解决方案 »

  1.   

    搜索一下嘛,坛子里好像有人已经问过了。
    看ms的文章:
    http://support.microsoft.com/kb/317881/EN-US/
      

  2.   

    创建MDB文件项目,添加引用-COM
    Microsoft Access x.0 Object LibraryAccess.Application a = new Access.ApplicationClass();
    a.NewCurrentDatabase("E:\\temp.mdb");
    a.Quit(Access.AcQuitOption.acQuitSaveAll);
      

  3.   

    http://blog.joycode.com/ghj/archive/2005/01/12/42861.aspx
      

  4.   

    Public Sub CreateExcel(ByVal _strExcelPath As String, ByVal _ExcelDataSet As DataSet, ByVal _strColumnName As String)
            Dim xlSheet As Excel.Worksheet
            Dim xlBook As Excel.Workbook
            Dim xlDBTable As Excel.DataTable
            Dim strPath As String        Try
                'エヲタ橫ミヨオイサヘャ」ャオシネ・XCELホトシホハフ・            'ームオレカチミオトヨオキナオスハラ鰒ミ
                Dim arry As ArrayList
                arry = New ArrayList
                Dim dr As DataRow
                Dim i As Integer = 0
                Dim strAll As String
                'クンオレカチミキヨソェノ嵭ノホトシ
                'ユメオスオレカチミイサヘャオトヨオキナオスハラ鰒ミ
                'モナサッ
                Dim dv As DataView
                dv = New DataView(_ExcelDataSet.Tables(0))
                'ハラマネスミナナミ・
                dv.Sort = _strColumnName
                Dim tmp As String
                Dim drv As DataRowView
                For Each drv In dv
                    If tmp <> drv.Row(_strColumnName) Then
                        tmp = Convert.ToString(drv.Row(_strColumnName))
                        arry.Add(tmp)
                    End If
                Next            Dim k As Integer = 0
                For k = 0 To arry.Count - 1
                    Dim xlApp As New Excel.Application
                    xlBook = xlApp.Workbooks.Add
                    xlSheet = xlBook.Worksheets("sheet1")
                    '&#65421;&#65384;&#65401;&#63729;&#65428;&#65434;&#65418;&#63729;&#65431;鮠葭&#65389;&#65403;&#65399;&#65379;&#65388;&#65418;莎&#65403;&#65421;&#65388;&#65430;&#65397;&#65397;&#65412;XLS&#65422;&#65412;&#65404;&#63730;
                    '&#65430;&#65400;&#65398;&#65384;&#65424;&#65410;&#65410;&#65399;&#65406;&#65398;
                    strPath = _strExcelPath & "\" & k + 1 & ".xls"
                    Dim col As DataColumn
                    Dim colIndex As Integer = 0
                    For Each col In _ExcelDataSet.Tables(0).Columns
                        colIndex = colIndex + 1
                        '&#65397;&#65411;&#65397;&#65405;&#65411;&#65407;&#65409;&#65424;&#65397;&#65412;&#65393;&#12539;&#12539;
                        xlApp.Cells(1, colIndex) = col.ColumnName
                    Next                Dim row As DataRow
                    Dim rowIndex As Integer = 0
                    '&#65421;&#65384;&#65401;&#63729;&#65425;&#65389;&#65403;&#65399;&#65416;&#65377;&#65430;&#65397;&#65379;&#65388;&#65400;&#65395;&#65430;&#65397;
                    For Each row In _ExcelDataSet.Tables(0).Select(_strColumnName & "='" & Convert.ToString(arry(k)) & "'")
                        '&#65400;&#65395;&#65395;&#65397;
                        rowIndex = rowIndex + 1
                        colIndex = 0
                        For Each col In _ExcelDataSet.Tables(0).Columns
                            colIndex = colIndex + 1
                            xlApp.Cells(rowIndex, colIndex) = row(col.ColumnName)
                        Next                Next                xlBook.SaveAs(strPath, xlApp.ActiveWorkbook.FileFormat, "", "", xlApp.ActiveWorkbook.ReadOnlyRecommended, xlApp.ActiveWorkbook.CreateBackup, Excel.XlSaveAsAccessMode.xlShared.xlShared, xlApp.ActiveWorkbook.ConflictResolution, False, "", "")                '&#65418;&#65421;&#65399;&#65413;
                    xlBook.Close()
                    xlApp.Quit()
                    xlApp = Nothing
                Next
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End Sub这是前几天我用到的。是用VB.NET写的。参数是,路径,DATASET,根据列值分开生成EXCEL文件的列名,你修改一下就可以了。
    根据列值生成不同的文件是业务需要,改一下就行了。原来用中文后来改为日文字体乱了。呵论坛里搜excel挺多介绍的