且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

读取Excel工作表数据并将其复制到另一个Excel工作表中

更新时间:2022-12-11 23:26:24

逐个读取Excel单元格并将其存储在Arraylist/DataTable中.并再次阅读.这是很好的链接

http://***.com/questions/5417088/transfering-data- from-one-excel-file-to-another [ ^ ]
Read the excel cell by cell and sttore it in Arraylist/DataTable. and read it again. Here is good Link

http://***.com/questions/5417088/transfering-data-from-one-excel-file-to-another[^]


           string docpath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string path = string.Format(docpath + @"\Report{0:yyyy_MM_dd}.xls",DateTime.Now.Date);
        
string path2 = // User choosen path. Use File Browser to get the path
        try 
        {
            // Create the file and clean up handles.
            using (FileStream fs = File.Create(path)) {}
            // Ensure that the target does not exist.
            File.Delete(path2);
            // Copy the file.
            File.Copy(path, path2);
        } 
        catch 
        {
        
        }
}