Excel C#输入到特定的单元格 [英] Excel C# inputting into specific cell

查看:145
本文介绍了Excel C#输入到特定的单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图用C#自动将数字6放入单元格F6。我一直在寻找,我找不到一个直接的答案。我已经在我的C#表单中引用了excel。任何帮助都非常感谢。

I am trying to just get excel to put the Number "6" into cell "F6" automatically using C#. I have been looking all over and I can't find a straight answer. I referenced excel in my C# form already. Any help is greatly appreciated

using Excel = Microsoft.Office.Interop.Excel;


推荐答案

在线文档

var xl = new Excel.Application();
xl.Visible = true;
var wb = (Excel._Workbook)(xl.Workbooks.Add(Missing.Value));
var sheet = (Excel._Worksheet)wb.ActiveSheet;
sheet.Cells[6, 6] = "6";

其他有价值的资源可以在这个问题

Other valuable resources can be found in this question.

这篇关于Excel C#输入到特定的单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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