如何在C#visual studio中将数据从表单传输到Excel? [英] How to transfer data from a form to an excel in C# visual studio?

查看:141
本文介绍了如何在C#visual studio中将数据从表单传输到Excel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个打开表单的Windows应用程序(wpf)。该表单包含几个控件,如comboBoxs和TextBox和ListBox ..

我想将表单中用户写入的数据传输到excel。

我一直在寻找互联网上的几个教程,但由于我是c#的初学者,我找不到我能理解和简单应用的东西。

如果你可以帮助我或者给我建议,那将是非常温和的。



提前谢谢



我尝试了什么:



我试图使用Interop方法。问题只是第一个组合框。选择的项目插入到我的第一个excel单元格中,甚至没有保存。

I am developping a windows app ( wpf) that opens a form. The form contains several controls like comboBoxs and TextBox and ListBox..
I would like to transfer the data written by the user in the form to an excel.
I have been looking to several tutorials on internet but since i am a beginner in c#, i couldn't find something that i could understand and apply simply.
It would be very gentle from yu if you could help me or just give me advice.

Thank you in advance

What I have tried:

I have tried to use the Interop method. The problem is only the first combobox.Selected Item is inserted in my first cell of the excel and it is not even saved.

推荐答案

参见使用MS Excel(xls / xlsx)使用MDAC和Oledb [ ^ ]。


非常感谢您的回答! tutoriel非常有趣!但是这个tutoriel中提出的解决方案处理的是一种不允许我编辑excel的方法吗?但我需要的是创建一个excel,当我可以在每次使用表单时放入所有数据然后我需要它是可编辑的,以防用户想要修改的东西。是否可以这样做?
Thank you very much for your answer! The tutoriel is very interseting ! But the solution that is suggested in this tutoriel deals with a method that doesn't allow me to edit the excel that's right? but what i need is creating an excel when i can put all the data everytime the form is used and then i need it to be editable in case the user wants to modify something. Is it possible to do it?


这篇关于如何在C#visual studio中将数据从表单传输到Excel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆