如何将数组放入Excel范围 [英] How to put array into excel range
本文介绍了如何将数组放入Excel范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道如何将单个单元格写入excel,但是当我在数组excel表上尝试时,它仅填充了最后一个值
这是我的范围
I know how to write single cell into excel but when im trying it on array excel sheet is filling with only last value
this is my range
Excel.Range ServiceName = (Excel.Range)_sheet.get_Range(_sheet.Cells[38, "B"] as Excel.Range, _sheet.Cells[45, "B"] as Excel.Range);
_ServiceName是包含1,2,3,4,5,6
的列表
_ServiceName is List which contains 1,2,3,4,5,6
for (int i = 0; i < _ServiceName.Count; i++)
{
ServiceNameArray[0, i] = _ServiceName[i];
}
这是我尝试写入excel的过程,但正如我所说的,excel书中只有最后一项(6)
this i my trying to write into excel but as i said it there is only last item (6) in excel book
for (int i = 0; i < _ServiceName.Count; i++)
{
ServiceName.set_Value(Type.Missing, ServiceNameArray[0,i]);
}
does anyone have an idea?
推荐答案
我认为获取Excel单元格范围存在一些问题.
您可以在此此处找到VB.Net文章.转到第三部分对象粘贴方法",我有使用范围填充Excel工作表.
或者这些链接可能对您有帮助.
http://stackoverflow.com/questions/536636/write-array-to-excel-range [ ^ ]
http://support.microsoft.com/kb/302096 [
I think there is some problem in getting range of excel cells.
You can find a VB.Net article on this here. Go to third section Object Pasting Method, I have used Range to populate the Excel Sheet.
Or these link might help you.
http://stackoverflow.com/questions/536636/write-array-to-excel-range[^]
http://support.microsoft.com/kb/302096[^]
完全 ^ ],绝对可以帮助您.
Fairly useful link[^], should definitely help you out.
这篇关于如何将数组放入Excel范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文