简体   繁体   English

需要比较两个excel文件

[英]Need to compare two excel files

I have to compare two Excel files having different number of sheets, different number of columns/rows, merged cells, formulas etc. 我必须比较两个具有不同页数,不同列数/行数,合并单元格,公式等的Excel文件。

The output of the comparison should allow the user to see which rows/columns were added, deleted, modified, re-arranged. 比较的输出应允许用户查看添加,删除,修改,重新排列的行/列。 This whole thing has to be done using C#,.NET 这一切都必须使用C#,.NET完成

Can anyone help me out? 谁能帮我吗?

You need to define your scope better. 您需要更好地定义范围。 As @Brijeesh suggested, there are 3rd party libraries like EPPLus, and also NPOI for reading the files. 正如@Brijeesh建议的那样,有第三方库,如EPPLus,还有NPOI用于读取文件。 But this is not about reading the files, but rather performing some "comparison" that you have an idea in your head how you want it to happen. 但这不是关于阅读文件,而是执行一些“比较”,你脑子里想到了你想要它发生的事情。

This question is too broad to be answered in a single thread like this. 这个问题过于宽泛,无法在这样的单个帖子中得到解答。

  • Are the spreadsheets in a known format? 电子表格是否为已知格式?
  • Do you only want to check certain sheets / columns ? 你只想检查某些床单/栏吗?
  • You mentioned wanting to see which columns were re-arranged, this implies knowing what order they were in the first place. 你提到想要查看哪些列被重新排列,这意味着要知道它们首先是什么顺序。 Again - is the spreadsheet in a known format? 再次 - 是一种已知格式的电子表格?

You should start to answer these questions, and trim down the scope of what you're trying to do into manageable tasks. 您应该开始回答这些问题,并将您尝试做的事情的范围缩小到可管理的任务中。

EDIT: 编辑:

VSTO has its benefits, and it's downfalls (the user must have excel installed). VSTO有它的好处,它的缺点(用户必须安装excel)。 3rd party libraries also have their ups and downs. 第三方图书馆也有起伏。 Which method you should use for accessing the spreadsheets was not the question in this thread. 您应该使用哪种方法来访问电子表格,这不是此主题中的问题。

Again - focus on one thing at a time. 再次 - 一次关注一件事。 What do you want to compare, and how do you want to do it? 你想要比较什么,你想怎么做? Then you can worry about which library you should use. 然后你可以担心你应该使用哪个库。 Though - when you're ready to ask that question, open a separate question so that the posts can stay on topic. 虽然 - 当您准备提出这个问题时,请打开一个单独的问题,以便帖子可以保留主题。

如果不符合您的要求使用VSTO /办公室互操作,请查看epplus

I created a spreadsheet macro that compares two spreadsheets together and highlights differences. 我创建了一个电子表格宏,将两个电子表格进行比较并突出显示差异。 You have to login to download it but you can use your Google login. 您必须登录才能下载,但您可以使用Google登录信息。 The VBA code is not locked and it might give you a start to port it to C# VBA代码未锁定,它可能会让您开始将其移植到C#

http://www.run8tech.com/tools.aspx http://www.run8tech.com/tools.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM