最近有个需求要在WPF中预览Excel文件。Research 一天下来,大概有三种方法。
1. Convert Excel to XPS and Using DocumentViewer.
http://stackoverflow.com/a/15871172/5189077
2. Using Webbrowser.
http://stackoverflow.com/a/1859655/5189077
3. using HwndHost, windows 的预览功能去预览文件,这样不仅可以预览Excel,还有Word,PDF等等文件类型。
http://stackoverflow.com/a/15870570/5189077
https://hmadrigal.wordpress.com/2013/01/02/previewing-microsoft-office-documents-and-pdf-in-wpf-using-a-preview-handler-host/
Also, Here has a helpful lib.
https://wpffilepreviewer.codeplex.com/