Spreadsheet Compare (Office 2013) automation from .NET application or VSTO add-in

橙三吉。 提交于 2020-01-13 00:30:14

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!