CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2012
    Posts
    18

    Exporting from access to excel with .net (c#)

    Hi

    The problem is that I have big files (50k lines +) from merging different excel sheets (through c# and little manipulation in datagrids) and I want to export them in excel again.

    All methods I've tried are really slow for this size of files (in my pc is about 1 1/2 min for a 1000 lines. I havent tested yet the spire, but anyway I don't want to do it this way.

    Up to now I saved the datatable as xml and then import it in access and export it in xls. This procedure is very fast in contrast to importing from xml directly in excel (which is actually the same slow as doing it with COM cell2cell through c#)

    Is there anyway to use this ms-access export to Excel procedure through access.interop?

    Thanks.
    Last edited by dazibao; October 30th, 2012 at 11:00 AM.

  2. #2
    Join Date
    Oct 2012
    Posts
    18

    Re: Exporting from access to excel with .net (c#)

    In case someone needs it this is it:

    Code:
     oAccess.DoCmd.TransferSpreadsheet(Microsoft.Office.Interop.Access.AcDataTransferType.acExport,
                                   Microsoft.Office.Interop.Access.AcSpreadSheetType.acSpreadsheetTypeExcel12Xml,
                                     "TableName", @"pathToSave", bHasFieldNames);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured