本文介绍了如何获得工作在.NET的名字吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是NPOI被迫微软互操作,我必须执行找到一定的工作表的工作簿的任务,然后通过它的每一行。
Being forced from NPOI to microsoft interop, I have to perform a task of finding a certain worksheet in workbook, and then iterate through every row of it.
在NPOI这将是简单的 workbook.GetSheet(sheetName);
。什么是微软互操作相当于这个?
In NPOI it would be simply workbook.GetSheet(sheetName);
. What would be the equivalent for this in microsoft interop?
推荐答案
使用 workbook.Sheets [sheetName];
完整的工作例如:
using Microsoft.Office.Interop.Excel;
class Program
{
static void Main(string[] args)
{
var excelApplication = new Application();
excelApplication.Visible = true;
excelApplication.SheetsInNewWorkbook = 3;
var workbook = excelApplication.Workbooks.Add();
var worksheet = workbook.Sheets["Sheet2"]; //<--- desired method
worksheet.Activate();
}
}
这篇关于如何获得工作在.NET的名字吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!