How to import DataSet into Excel?

xiaoxiao2021-03-06  20

/ ** /

///

/// Import all data in DataSet EXCEL /// Need to add COM: Microsoft Excel Object Library /// using excel; /// /// File Path /// DataSet required to be saved

public

Static

Void

EXPORTTOEXCEL (

String

Filepath, DataSet DS)

...

{Object omissing = system.reflection.Missing.Value; Excel.ApplicationClass XLAPP = New Excel.ApplicationClass (); try ... {// Open an Excel file. The following is a Office 2000. Excel.Workbook xlWorkbook = xlApp.Workbooks.Open (filePath, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing); Excel.Worksheet xlWorksheet; // Cycling all DataTable for (int i = 0; i

转载请注明原文地址:https://www.9cbs.com/read-43003.html

New Post(0)