如何在winform中嵌入excel?
引用office11.0组件后, Microsoft.Office.Interop.Excel.Application application; //这是一个客户端Microsoft.Office.Interop.Excel.Workbooks workbooks; //所有工作薄Microsoft.Office.Interop.Excel.Worksheet worksheet;//工作表Microsoft.Office.Interop.Excel.Workbook workbook; //所用到的工作表 void IsRunEX(){ OpenFileDialog openfilediaglog = new OpenFileDialog();openfilediaglog.Filter = "xls文件|*.xls";if (openfilediaglog.ShowDialog() == DialogResult.OK){FieldName = openfilediaglog.FileName;application = new Microsoft.Office.Interop.Excel.Application();workbooks = application.Workbooks;workbook = returnworkbook(FieldName, workbooks);worksheet = (Microsoft.Office.Interop.Excel.Worksheet)workbook.Sheets[1]; //选择第一个表
到此,以上就是小编对于winform导入excel数据的问题就介绍到这了,希望介绍的1点解答对大家有用,有任何问题和不懂的,欢迎各位老师在评论区讨论,给我留言。