C# 读取word2003 并且显示在界面上的方法
1.新建一个windows窗体程序

2. 引入包WinWordControl.dll
3.添加引用

4.引入组件WinWordControl组件

5.主界面上加入按钮 ,opendialog, winwordcontrol
第一个为winwordcontrol
第二个为button1
第三个为opendialog
如图

6.读取显示
一,直接读取显示
form1写法,
using System; using System.Windows.Forms; namespace wordtest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
string dir = Environment.CurrentDirectory + "\\debug或release目录下的文件名.doc";
winWordControl1.LoadDocument(dir);
} }
}
二,间接显示
form1写法,
using System; using System.Windows.Forms; namespace wordtest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
winWordControl1.LoadDocument(openFileDialog1.FileName);
MessageBox.Show(openFileDialog1.FileName);
} }
}
}
7.完成,间接显示效果如图

C# 读取word2003 并且显示在界面上的方法的更多相关文章
- 动态读取文件持续显示在UI上
private void DisplayLogInfo(FileInfo _LastFile) { if (_LastFile != null) { StreamReader sr = null; t ...
- 用JSP从数据库中读取图片并显示在网页上
<1>先在mysql下建立如下的table. 并insert图像. mysql.sql文件如下: CREATE TABLE photo ( photo_no int(6) unsigned ...
- C# 通过URL获取图片并显示在PictureBox上的方法
, ); System.Net.WebRequest webreq = System.Net.WebRequest.Create(url); System.Net.WebResponse webres ...
- Linux下DM无法显示建模界面的解决方法
方法来源: http://www.linuxhospital.com/read/unable-to-resolve-function-glxqueryextension-in-hyperview.ht ...
- Xamarin XAML语言教程将XAML设计的UI显示到界面
Xamarin XAML语言教程将XAML设计的UI显示到界面 如果通过XAML将UI设计好以后,就可以将XAML中的内容显示给用户了,也就是显示到界面上.由于创建XAML文件方式的不同,所以将XAM ...
- JAVA基础-输入输出:1.编写TextRw.java的Java应用程序,程序完成的功能是:首先向TextRw.txt中写入自己的学号和姓名,读取TextRw.txt中信息并将其显示在屏幕上。
1.编写TextRw.java的Java应用程序,程序完成的功能是:首先向TextRw.txt中写入自己的学号和姓名,读取TextRw.txt中信息并将其显示在屏幕上. package Test03; ...
- GS界面上显示的重要参考数据
GS界面上显示的重要参考数据,这个是压测时重要参考 struct GSinfo { int revBuffNum; int sendBuffNum; int clientNum; int dbAskN ...
- 图解android开发在界面上显示图片
图解android开发在界面上显示图片<申明:转自百度> <原文章地址:http://jingyan.baidu.com/article/49711c6153a277fa441b7c ...
- Unity在UI界面上显示3D模型/物体,控制模型旋转
Unity3D物体在UI界面的显示 本文提供全流程,中文翻译. Chinar 坚持将简单的生活方式,带给世人!(拥有更好的阅读体验 -- 高分辨率用户请根据需求调整网页缩放比例) Chinar -- ...
随机推荐
- 20145320《网络对抗》逆向及Bof基础实践
1 逆向及Bof基础实践说明 1.1 实践目标 本次实践的对象是一个名为pwn20145320的linux可执行文件. 该程序正常执行流程是:main调用foo函数,foo函数会简单回显任何用户输入的 ...
- 对于ListView的一些用法(一)
ScrollView:只能用于控件比较少的界面,如果数据有上千上万条,那么使用ScrollView就不好了,因为ScrollView就把所有的控件进行初始化,这是非常消耗性能的操作,所以android ...
- C# asp:FileUpload上传文件使用JS实现预览效果
js代码: <script type="text/javascript"> //下面用于图片上传预览功能 function setImagePreview() { va ...
- Connections in Galaxy War (逆向并查集)题解
Connections in Galaxy War In order to strengthen the defense ability, many stars in galaxy allied to ...
- hihoCoder week3 KMP算法
题目链接 https://hihocoder.com/contest/hiho3/problems kmp算法 #include <bits/stdc++.h> using namespa ...
- oracle单行函数 之 数字函数
Round(数字 \ 列 [,保留小数的位数]):四舍五入 select Round(1234.45,1) from dual = 1234.5 Trunc(数字 \ 列 [,保留小数的位数] ...
- 论文笔记之:Deep Attributes Driven Multi-Camera Person Re-identification
Deep Attributes Driven Multi-Camera Person Re-identification 2017-06-28 21:38:55 [Motivation] 本文 ...
- Unity3D学习笔记(二十七):MVC框架下的背包系统(2)
Tools FileTools using System.Collections; using System.Collections.Generic; using UnityEngine; using ...
- Druid介绍
Druid (大数据实时统计分析数据存储) Druid 是一个为在大数据集之上做实时统计分析而设计的开源数据存储.这个系统集合了一个面向列存储的层,一个分布式.shared-nothing的架构,和一 ...
- 4、Ansible(tags、roles)
Tags https://docs.ansible.com/ansible/latest/user_guide/playbooks_tags.html http://www.zsythink.net/ ...