Excel的C#输入到特定的细胞 [英] Excel C# inputting into specific cell

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

问题描述

我想一下就擅长把数字6到细胞F6自动使用C#。我一直在寻找一切都结束了,我找不到一个直接的答案。我在C#的形式引用的Excel已。任何帮助是极大的赞赏。



 使用Excel =的Microsoft.Office.Interop.Excel; 


解决方案

从的在线文档

  VAR XL =新Excel.Application(); 
xl.Visible = TRUE;
变种WB =(Excel._Workbook)(xl.Workbooks.Add(Missing.Value));
无功表=(Excel._Worksheet)wb.ActiveSheet;
sheet.Cells [6,6] =6;

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


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;

解决方案

Cribbed from the online documentation:

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天全站免登陆