问题
Is it possible to automate the new Spreadsheet Compare tool of Office 2013 from a .NET application or a VSTO Excel add-in by embedding some Microsoft assemblies?
A similar question was asked for VBA programming and the response was no.
I managed to execute the application "C:\Program Files (x86)\Microsoft Office\Office15\DCF\SPREADSHEETCOMPARE.EXE" in command-line with a text file as input argument containing two workbooks paths in separate lines, but it would be easier to call a method directly from the code, as for the other functions of Excel.
回答1:
I wrote a simple batch script that allows compare of two files from a command line. Please refer to github: https://github.com/kniklas/excomp for further details.
I hope it will help those who would like to automate process of excel comparison (e.g. to hook this for version control - diff - of excel files).
回答2:
A sample code on how this could be implemented can be found at:
Calling SpreadsheetCompare from command line
回答3:
Unfortunately, these workarounds will not work if your spreadsheets are maintained in TFS and you want to configure SpreadsheetCompare.exe as a user tool.
Configuring the tool to be used for Compare requires that both filenames be passed in as command line arguments.
来源:https://stackoverflow.com/questions/24366238/spreadsheet-compare-office-2013-automation-from-net-application-or-vsto-add-i