如何从数据库中填充Excel中的单元格 [英] How to fill the cells in excel from the database

查看:89
本文介绍了如何从数据库中填充Excel中的单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想从数据库中提取数据并将其填充到Excel工作表中.我将Excel模板保存在一个文件夹中.当我单击从excel下载按钮时,excel工作表应填充excel工作表所有选项卡中的所有单元格,并将其保存到其他文件夹中.谁能帮我解决这个问题.

在此先感谢

Hi,

I want to extract the datas from the database and fill it to the excel sheet. I am saving the excel template in one folder. When I click the download from excel button the excel sheet should fill all the cells in all the tabs of the excel sheet and save that to some other folder. Can anyone help me to solve this problem.

Thanks in Advance

推荐答案


您可以使用ExcelPackage,
http://excelpackage.codeplex.com/ [ ^ ]
它非常易于使用,并且在网站上提供了一些使用模板的代码示例.
希望对您有帮助.
Hi,
You can use ExcelPackage,
http://excelpackage.codeplex.com/[^]
It''s very easy to use and they got some examples of code using template on the site.
Hope this help you.


Excel具有内置的机制,可以从外部源导入数据.您可以使用数据连接来定义对数据库的查询,该查询将数据填充为excel.有关更多信息: http: //office.microsoft.com/zh-CN/excel-help/create-edit-and-manage-connections-to-external-data-HA010167227.aspx [
Excel has a built-in mechanism for importing data from external sources. You can use data connections to define a query to your database which fills data to excel. For more info: http://office.microsoft.com/en-us/excel-help/create-edit-and-manage-connections-to-external-data-HA010167227.aspx[^]

The saving can after that be done from c# (which you tagged) or with an excel macro etc.


这篇关于如何从数据库中填充Excel中的单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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