简体   繁体   English

在wpf中的窗口中打开excel文件

[英]Open excel file inside a window in wpf

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.

What you are looking for is Excel embedded in a Wpf Control. 您正在寻找的是嵌入在Wpf控件中的Excel。 This page could be a good start. 这个页面可能是一个好的开始。 To sum it up, it must be included in your UI using ActiveX. 总结一下,它必须使用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. 如果你需要模仿一些excel功能而不需要打开现有文件,那么互联网上有很多“excel like”控件是免费提供的。 For instance this one . 比如这一个

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

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