将.doc文件加载到多行文本框中 [英] Load .doc file to multi line text box

查看:56
本文介绍了将.doc文件加载到多行文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在文本框中加载.doc文件包含的内容.我使用的是代码:

I want to load .doc file containant in my text box.I use is code for it:

ApplicationClass wordApp = new ApplicationClass();

          string filePath = strPath;

          object file = filePath;

          object nullobj = System.Reflection.Missing.Value;

          Document doc = wordApp.Documents.Open(ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);

          Document doc1 = wordApp.ActiveDocument;

          string m_Content = doc1.Content.Text;

          TextBox1.Text = m_Content;

          doc.Close(ref nullobj, ref nullobj, ref nullobj);


但是通过这种方法,我无法获得准确的数据到我的文本框中,就像框中是否有粗体字母或文本一样.因此,请帮助我如何将完整的数据保存到.doc文件中的文本框中.


but by this method i am not get accurate data to my text box like if there is bold letter or text in box. So help me how i get complete data to my text box which are in my .doc file.

推荐答案

您不能.
测试盒不支持粗体或加框文本之类的文本效果.

您也许可以改用RichTextBox,但是随后您将必须找到一种方法来首先将Word文档转换为RTF格式.
You can''t.
Test boxes do not support text effects such as Bold, or boxed text.

You may be able to use a RichTextBox instead, but then you will have to find a way to convert the word document to RTF format first.


这篇关于将.doc文件加载到多行文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆