导航

最近一直在做C#操作office方面的工作!总结一下!(一)Excel

Posted on 2004-08-19 08:19  wngwz  阅读(9966)  评论(19编辑  收藏  举报
C#操作Excel!
    public class ImportExportToExcel
    
{
        
private string strConn ;
        
        
private System.Windows.Forms.OpenFileDialog openFileDlg=new System.Windows.Forms.OpenFileDialog();
        
private System.Windows.Forms.SaveFileDialog saveFileDlg=new System.Windows.Forms.SaveFileDialog();      
        
        
public ImportExportToExcel()
        
{
            
//
            
// TODO: 在此处添加构造函数逻辑
            
//
            this.openFileDlg.DefaultExt = "xls";
            
this.openFileDlg.Filter = "Excel文件 (*.xls)|*.xls";

            
this.saveFileDlg.DefaultExt="xls";
            
this.saveFileDlg.Filter= "Excel文件 (*.xls)|*.xls";

        }


        
从Excel文件导入到DataSet

        
从DataSet到出到Excel

        
从XML导入到Dataset

        
从DataSet导出到XML

    
    
    }