wpf 在wpf的窗口内打开excel文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24646872/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Open excel file inside a window in wpf
提问by mohammad
I want to show an excel file inside my wpf window like this:
我想在我的 wpf 窗口中显示一个 excel 文件,如下所示:


if I Create an excel application and then set Visible property to true, Excel application will open and I don't want this behavior.
如果我创建一个 excel 应用程序,然后将 Visible 属性设置为 true,Excel 应用程序将打开,我不希望出现这种行为。
Microsoft.Office.Interop.Excel.Application xlsxApp = new Microsoft.Office.Interop.Excel.Application();
Workbook workbook = xlsxApp.Workbooks.Open(path);
xlsxApp.Visible=true; //Excel will open, I don't want this.
回答by Askolein
What you are looking for is Excel embedded in a Wpf Control. This pagecould be a good start. To sum it up, it must be included in your UI using ActiveX.
您正在寻找的是嵌入在 Wpf 控件中的 Excel。这个页面可能是一个好的开始。总而言之,它必须使用 ActiveX 包含在您的 UI 中。
There is not pure WPF excel control per se.
本身没有纯粹的 WPF excel 控件。
If you need to mimic some excel features without the need to open an existing file, there are plenty of "excel like" controls available on the internet free or not. For instance this one.
如果您需要在无需打开现有文件的情况下模拟某些 excel 功能,互联网上有许多“类似 excel”的控件可供免费使用。比如这个。

