【发布时间】:2023-03-28 16:24:02
【问题描述】:
我正在阅读 C# 中的 Excel 文件。文件中有 3 张工作表:
- 总结
- 用户
- 其他
我正在遍历摘要表的列。(下面的代码)
每张纸都有一列:SummaryID。
foreach (DataColumn dc in Summary.Columns)
{
foreach (DataRow dr in Summary.AsEnumerable())
{
//get column SummaryID for everyrow
//And then get all rows in Users sheet that match SummaryID
//And then get all rows in Others sheet that match SummaryID
}
}
我的问题是:对于摘要表 (SummaryID) 中的每一行,我想获取与“用户”和“其他”表中的 SummaryID 匹配的所有匹配行。
注意:SummaryID 列存在于所有 3 张工作表中,并且是所有工作表中的第一列。
【问题讨论】:
-
你的问题是什么..你做了一个陈述而不是一个问题..你应该问
get matching row based on SummaryID这是一个正确的假设吗..?你能展示你是如何连接到 Excel 电子表格的吗?您是否有声明 Excel 应用程序实例的现有代码?