导航:首页 > 文件教程 > winform显示word的控件

winform显示word的控件

发布时间:2021-03-07 15:22:59

Ⅰ 怎么才能让在winform中用webbrowse打开的word自动显示工具栏(C#)

Webbrowser里的任何控件你都无法控制的...(除可赋值属性)

Ⅱ winform 读取word跟直接打开word显示界面一模一样

客户不满意???抽Y的!
叫他直接下载word就好了
难道在开发一个word

如果你打不过他,可以考虑,用模拟的方式
上面写几个按钮,下面是个大文本框
然后写文件

Ⅲ 在winform 显示office

http://www.codeproject.com/KB/miscctrl/winwordcontrol.aspx
winwordcontrol,我们做项目就用抄这个插件,如袭果你要例子可以发消息给我。
问我要了代码不给分,真没素质!

Ⅳ 如何在C# winform中嵌入word文档

复制的,但是觉得在WebBroswer里面显示Word可行

在 Visual C# .NET 中新建一个 Windows 应用程序项目。默认情况下会创建 Form1。
在工具菜单上,单击自定义工具箱以打开自定义工具箱对话框。在 COM 组件选项卡上,添加一个对 Microsoft WebBrowser 的引用。单击确定,将 WebBrowser 控件添加到 Windows 窗体工具箱。WebBrowser 控件会显示出来,并且在工具箱中带有 Explorer(资源管理器)字样。
使用该工具箱向 Form1 添加一个 WebBrowser 控件、一个 OpenFileDialog 控件和一个 CommandButton 按钮。这就会向 Form1 类添加 AxWebBrowser1、OpenFileDialog1 和 Button1 成员变量。
在 Form1 上,双击 button1。这就会向 Form1 添加 Button1_Click 事件。
在 Form1 的代码窗口中,向列表添加以下命名空间:using System.Reflection;

如下所示在 Form1 类中定义一个私有成员:private Object oDocument;
在 Form1 类的 InitializeComponent 方法的末尾,添加以下代码以处理 Form1_Load、Form1_Closed 和 axWebBrowser1_NavigateComplete2 事件:this.axWebBrowser1.NavigateComplete2 += new AxSHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(this.axWebBrowser1_NavigateComplete2);
this.Load += new System.EventHandler(this.Form1_Load);
this.Closed += new System.EventHandler(this.Form1_Closed);

将下面的代码private void button1_Click(object sender, System.EventArgs e)
{
}

替换为: private void button1_Click(object sender, System.EventArgs e)
{

String strFileName;

//Find the Office document.
openFileDialog1.FileName = "";
openFileDialog1.ShowDialog();
strFileName = openFileDialog1.FileName;

//If the user does not cancel, open the document.
if(strFileName.Length != 0)
{
Object refmissing = System.Reflection.Missing.Value;
oDocument = null;
axWebBrowser1.Navigate(strFileName, ref refmissing , ref refmissing , ref refmissing , ref refmissing);
}
}

public void Form1_Load(object sender, System.EventArgs e)
{
button1.Text = "Browse";
openFileDialog1.Filter = "Office Documents(*.doc, *.xls, *.ppt)|*.doc;*.xls;*.ppt" ;
openFileDialog1.FilterIndex = 1;
}

public void Form1_Closed(object sender, System.EventArgs e)
{
oDocument = null;
}

public void axWebBrowser1_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)
{

//Note: You can use the reference to the document object to
// automate the document server.

Object o = e.pDisp;

oDocument = o.GetType().InvokeMember("Document",BindingFlags.GetProperty,null,o,null);

Object oApplication = o.GetType().InvokeMember("Application",BindingFlags.GetProperty,null,oDocument,null);

Object oName = o.GetType().InvokeMember("Name",BindingFlags.GetProperty ,null,oApplication,null);

MessageBox.Show("File opened by: " + oName.ToString() );
}

按 F5 键运行该项目。单击浏览后,会出现打开对话框,您可以使用该对话框浏览到 Word 文档、Excel 工作表或 PowerPoint 演示文稿。选择任一文件,然后单击打开。文档在 WebBrowser 控件内打开,并出现一个显示有 Office 文档服务器名称的消息框。

Ⅳ 如何在winform中显示office文档

你如果想WinForm打开Word处理,不妨使用RichTextBox,RichTextBox有两个方法:LoadFile方法(加载内RTF)容SaveFile(加载RTF)http://msdn.microsoft.com/zh-cn/library/system.windows.forms.richtextbox.aspx

Ⅵ c#,winForm嵌入word并能操作文档

在 Visual C# .NET 中新建一个 Windows 应用程序项目。默认情况下会创建 Form1。
在工具菜单上,单击自定义工具箱以打开自定义工具箱对话框。在 COM 组件选项卡上,添加一个对 Microsoft WebBrowser 的引用。单击确定,将 WebBrowser 控件添加到 Windows 窗体工具箱。WebBrowser 控件会显示出来,并且在工具箱中带有 Explorer(资源管理器)字样。
使用该工具箱向 Form1 添加一个 WebBrowser 控件、一个 OpenFileDialog 控件和一个 CommandButton 按钮。这就会向 Form1 类添加 AxWebBrowser1、OpenFileDialog1 和 Button1 成员变量。
在 Form1 上,双击 button1。这就会向 Form1 添加 Button1_Click 事件。
在 Form1 的代码窗口中,向列表添加以下命名空间:using System.Reflection;

如下所示在 Form1 类中定义一个私有成员:private Object oDocument;
在 Form1 类的 InitializeComponent 方法的末尾,添加以下代码以处理 Form1_Load、Form1_Closed 和 axWebBrowser1_NavigateComplete2 事件:this.axWebBrowser1.NavigateComplete2 += new AxSHDocVw.DWebBrowserEvents2_NavigateComplete2EventHandler(this.axWebBrowser1_NavigateComplete2);
this.Load += new System.EventHandler(this.Form1_Load);
this.Closed += new System.EventHandler(this.Form1_Closed);

将下面的代码private void button1_Click(object sender, System.EventArgs e)
{
}

替换为: private void button1_Click(object sender, System.EventArgs e)
{

String strFileName;

//Find the Office document.
openFileDialog1.FileName = "";
openFileDialog1.ShowDialog();
strFileName = openFileDialog1.FileName;

//If the user does not cancel, open the document.
if(strFileName.Length != 0)
{
Object refmissing = System.Reflection.Missing.Value;
oDocument = null;
axWebBrowser1.Navigate(strFileName, ref refmissing , ref refmissing , ref refmissing , ref refmissing);
}
}

public void Form1_Load(object sender, System.EventArgs e)
{
button1.Text = "Browse";
openFileDialog1.Filter = "Office Documents(*.doc, *.xls, *.ppt)|*.doc;*.xls;*.ppt" ;
openFileDialog1.FilterIndex = 1;
}

public void Form1_Closed(object sender, System.EventArgs e)
{
oDocument = null;
}

public void axWebBrowser1_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)
{

//Note: You can use the reference to the document object to
// automate the document server.

Object o = e.pDisp;

oDocument = o.GetType().InvokeMember("Document",BindingFlags.GetProperty,null,o,null);

Object oApplication = o.GetType().InvokeMember("Application",BindingFlags.GetProperty,null,oDocument,null);

Object oName = o.GetType().InvokeMember("Name",BindingFlags.GetProperty ,null,oApplication,null);

MessageBox.Show("File opened by: " + oName.ToString() );
}

按 F5 键运行该项目。单击浏览后,会出现打开对话框,您可以使用该对话框浏览到 Word 文档、Excel 工作表或 PowerPoint 演示文稿。选择任一文件,然后单击打开。文档在 WebBrowser 控件内打开,并出现一个显示有 Office 文档服务器名称的消息框。

Ⅶ C# winform的webbrowser控件怎么读取word文档并显示

从office07版本开始用webBrowser1.Navigate()就只能打开word而不能显示了,建议尝试其它方法。

Ⅷ c# winform 读取wrod文档简历 然后显示在相对应的控件上

05年的时候我还真做过一次。我找找看程序还在不在,找到了我告诉你

Ⅸ c# winform 怎么通过微软自带控件显示office2010版本的word

我用的TX TextControl可以,功能还包括文档创建、编辑、打印、邮件合并、格式转换、拆分合并、导入导出、批量生成等。可以看看。

Ⅹ C#winform 里怎样可以预览word文档

使用DSOFramer控件。去年我做过一个项目,就是用这个控件来操作Excel文件的。用它也可以操作word文档。如果不喜欢这个控件,可以使用浏览器控件如WebBroswer来嵌入网页版

阅读全文

与winform显示word的控件相关的资料

热点内容
word把数字变斜 浏览:372
小米6忘记锁屏密码怎么办啊 浏览:462
北京白领都用什么社交app 浏览:518
政法app哪个好用 浏览:514
房产平台如何推广新网站 浏览:701
u盘导文件总是中断 浏览:995
下载的招标文件打不开是为什么 浏览:356
都市美艳后宫 浏览:435
十部顶级古埃及电影 浏览:107
linux用户读写权限 浏览:936
少侠十七妻全文阅读 浏览:422
公主奴 浏览:856
k9d3 浏览:182
分卷阅读 玩武警少尉 浏览:44
知乎写小说入口 浏览:772
美国农场爱情片 浏览:709
主角一开始就长生不老 浏览:338
mike文件内容和输入不匹配 浏览:499
plsql怎么连接数据库连接 浏览:951
大黄文 浏览:213

友情链接