Re: [問題] 取得Excel的所有sheet
不好意思,又有問題想請教一下
我要如何去取得目前使用中的sheet的column和row的數目?
下面是我的code,不過取出來的columns.count都是256
謝謝
public string[] GetSheetHeader()
{
string[] header = new string[excelWorksheet.Columns.Count];
Excel.Range oRange = null;
int i = 0;
if (this.excelSheets != null)
{
for (i = 0; i < excelWorksheet.Columns.Count; i++)
{
oRange = excelApp.get_Range(excelApp.Cells[1, i + 1],
excelApp.Cells[1, i + 1]);
header[i] = oRange.Value2.ToString();
}
}
return header;
}
--
★
╔╮ ╭═╦╮╭═╦╗╮ ╮╔══╮╭═╦╮╮ ╔╮╔══╮╭══╮
╠╣ ╠═╬╣╭╬╩╯╰╦╦╯╠═╦╮║ ╠╣║║╠╣╠╣ ╰═╦╮
╠╣ ╭║ ╠╣║╰╔╗ ╠╣ ║ ╠╣║ ╠╣║╰╠╣║╰╔╗║ ╠╣
╰╩═╯╰ ╰╝╚═╩╯ ╰╝ ╚═╩╯╰═╩╯╰ ╰╝╚═╩╯╰═╩╯
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.20.144.252
推
06/30 00:03, , 1F
06/30 00:03, 1F
→
06/30 00:52, , 2F
06/30 00:52, 2F
→
06/30 11:23, , 3F
06/30 11:23, 3F
※ 編輯: lazybones 來自: 210.69.124.17 (06/30 15:59)
推
07/06 00:24, , 4F
07/06 00:24, 4F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):