摘要
在C#.NET下将DataGridView中的数据导入Excel表格,常用的方法是通过Excel的COM组件来实现在C#中和Excel交互。由于开发计算机和用户计算机上安装的Excel版本不同,经常会导致不兼容的现象。为了解决这个问题,本文提出利用反射技术来实现C#和Excel交互。在安装不同版本的Excel的机器上进行实验,结果表明该方案很好地解决版本兼容性问题。
In C#.NET,the commonly method of export the data in the component of DataGridView into Excel uses the Excel's COM component to achieve it.But because the vision of Excel between the development machine and user's machine installed maybe different,this method often leads to the phenomenon of incompatible.To solve this problem,the reflection technique is proposed to implement the interaction of C# and Excel.Through the experiment on the computer with different visions of Excel,the results show that this method can solve the problem of version compatibility very well.
出处
《计算机与现代化》
2011年第4期29-31,共3页
Computer and Modernization