从C#填充Excel文档 [英] Fill excel doc from C#
本文介绍了从C#填充Excel文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好.
我有一个小型C#项目.
我想在.xls文件中写一些值.
屏幕是红色吗?是我要填充的列
请告诉我是否有可能,如果可以,请提供一些很好的教程
这是图片
http://img192.imageshack.us/img192/5402/37695348.jpg
Hello.
I have small c# project.
I want to write some values in .xls file.
This is screen red ? is columns which I want to fill
Please tell me if it possible and if so please give some good tutorial
this is pic
http://img192.imageshack.us/img192/5402/37695348.jpg
推荐答案
请参见
http://social.msdn.microsoft.com/论坛/en-US/csharpgeneral/thread/ef11a193-54f3-407b-9374-9f5770fd9fd7 [ http://www.codeproject.com/KB/cs/Excel_and_C_.aspx [ ^ ]
http://support.microsoft.com/kb/306023 [
See
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/ef11a193-54f3-407b-9374-9f5770fd9fd7[^]
http://www.codeproject.com/KB/cs/Excel_and_C_.aspx[^]
http://support.microsoft.com/kb/306023[^]
^ ]
C#Corner也是一个有用的开发人员网站.
(应该说,非常反CP,但这是c#的专业论坛.)
This may Help[^]
C# Corner is also a useful developer site.
(Shouldn''t say, very anti CP, but it is a specialist forum for c#.)
public static void XLSWriter(string filename, string desiredcell, double number)
{
try
{
string path = @"c:\Documents and Settings\rdockter\My Documents\" + file + "";
string connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties=\"Excel 8.0;HDR=NO;READONLY=FALSE\"";
OleDbConnection conn = new OleDbConnection(connectionstring);
OleDbCommand command = new OleDbCommand();
conn.Open();
command.Connection = conn;
string Sql = "UPDATE [Sheet1
这篇关于从C#填充Excel文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文