我如何在.Net2.0中比较两个Excel工作表?
我有两个文本文件(这是一个逗号分隔的文件)。这两个文件的模板如下。
SD,CurrentDate,RecordCount
NI,FirstName,LastName,Place,Language
EQ,Degree,University,Year,Aggregate
ED,CurrentDate,RecordCount
第一个文件中的数据 - one.txt
SD,13/06/2010,6
NI,Rajesh,kumar,xxxx,english
EQ,X,Stateboard,2004,75
EQ,XII,Stateboard,2006,85
EQ,B.E,Oxford,2008,79
ED,13/06/2010,6
第二个文件中的数据 - Second.txt
SD,13/06/2010,6
NI,Rajesh,kumar,,english
EQ,X,,2004,75
EQ,XII,Stateboard,2006,
EQ,,Oxford,2008,79
ED,13/06/2010,6
现在我已将 one.txt 的值填充到 Excel 工作表(Output.xls)的“sheet1”中,然后我填充
了使用.Net代码将Second.txt的值添加到Excel工作表(Output.xls)的“sheet2”中。
现在我想比较两个工作表数据并填充“sheet3”中的差异。
“Sheet3”的 o/p 将会有。
Cell1 Cell2 Cell3 Cell4 Cell5
SD:True CurrentDate:True RecordCount:True
NI:True FirstName:True LastName:True Place:False Language:True
EQ:True Degree:True University:False Year:True Aggregate:True
EQ:True Degree:True University:True Year:True Aggregate:False
EQ:True Degree:False University:True Year:True Aggregate:True
SD:True CurrentDate:True RecordCount:True
我如何比较这两张纸?通过VBA可以吗?我可以在.Net中调用VBA代码吗?请有人给我解决方案吗?
I am having two text files ( which is a comma separated file).The template of the two file is given below.
SD,CurrentDate,RecordCount
NI,FirstName,LastName,Place,Language
EQ,Degree,University,Year,Aggregate
ED,CurrentDate,RecordCount
The Data in the first file - one.txt
SD,13/06/2010,6
NI,Rajesh,kumar,xxxx,english
EQ,X,Stateboard,2004,75
EQ,XII,Stateboard,2006,85
EQ,B.E,Oxford,2008,79
ED,13/06/2010,6
The Data in the Second file - Second.txt
SD,13/06/2010,6
NI,Rajesh,kumar,,english
EQ,X,,2004,75
EQ,XII,Stateboard,2006,
EQ,,Oxford,2008,79
ED,13/06/2010,6
Now I have populted the value of the one.txt to the "sheet1" of Excel sheet(Output.xls) and then i have populated
the value of the Second.txt to the "sheet2" of Excel sheet(Output.xls) by using the .Net code.
Now i want to compare two sheets data and populte the difference in the "sheet3".
The o/p of the "Sheet3" will have.
Cell1 Cell2 Cell3 Cell4 Cell5
SD:True CurrentDate:True RecordCount:True
NI:True FirstName:True LastName:True Place:False Language:True
EQ:True Degree:True University:False Year:True Aggregate:True
EQ:True Degree:True University:True Year:True Aggregate:False
EQ:True Degree:False University:True Year:True Aggregate:True
SD:True CurrentDate:True RecordCount:True
How can i compare this two sheets? Is it possible through VBA? Can i able to call the VBA code in .Net?Please anyone provide me the solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎想在手动或夸张地填充值后比较 2 张纸。在这种情况下,以下代码将完成这项工作,但您必须修改将在布尔值之前插入列名称的部分
It seems that you would like to compare 2 sheets after you have manually or melodramatically populated the values to. In this case the following code will do the job, but you have to modify the parts that will insert the column name before the boolean value