从服务器的asp.net中的msword文件读取文本内容 [英] read the text content from msword file in asp.net at the server

查看:85
本文介绍了从服务器的asp.net中的msword文件读取文本内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,

用于以下代码从msword应用程序中获取简历,然后显示在本地iis的文本框中.

然后将应用程序部署到dll中.

然后使用filezilla
上传服务器
但应用程序未阅读文档且未在服务器上显示

请给我解决方法.

hi sir,

am used following code to fetch the resume from msword application then show into text box in local iis.

then deployed application into dll.

then uploaded the server using filezilla

but the application doesn''t read the document and not showing the at server

please give me the solution.

msWord.ApplicationClass oWord = new msWord.ApplicationClass();
            object nullobj = System.Reflection.Missing.Value;
            string location = Server.MapPath("~") + "\\Resumes\\" + "SVCM-00002.doc";
            object file = location;
            Word.Document oWordDoc = (Word.Document)(oWord.Documents.Add(ref file, ref nullobj, ref nullobj, ref nullobj));
            string str = oWordDoc.Content.Text;
            str.Replace("\n", "<br>");
            str.Replace("\r", "<br>");
            //txtresume.Text = "";
            str.ToString().Trim();


根据您的建议也使用了以下代码


based on your suggession am used following code too

using(System.IO. StreamReader sr=new System.IO. StreamReader())
{
 textbox.text=sr.ReadToEnd();
}


这显示了文本之前和之后的不需要的对象



我也尝试过您的代码,但没有进展

这也仅适用于本地,不支持服务器

请给我适当的解决方案


msWord.ApplicationClass wordApp =新的msWord.ApplicationClass();
//object nullobj = System.Reflection.Missing.Value;
字符串位置= Server.MapPath(〜")+"\\ Resumes \\" +"SVCM-00002.doc";
目标文件=位置;
对象nullobj = System.Reflection.Missing.Value;
Word.Document doc =(Word.Document)(wordApp.Documents.Add(参考文件,参考nullobj,参考nullobj,参考nullobj));
字符串ss = doc.Content.Text;
doc.ActiveWindow.Selection.WholeStory();
doc.ActiveWindow.Selection.Copy();
//IDataObject数据= Clipboard.GetDataObject();
//TextBox1.Text = data.GetData(DataFormats.Text).ToString();
TextBox1.Text = doc.ToString();


This showing unwanted objects before text and after text



am tried ur code also but not progress

this also suitable only locally , not support in server

please give me a proper solutions


msWord.ApplicationClass wordApp = new msWord.ApplicationClass();
//object nullobj = System.Reflection.Missing.Value;
string location = Server.MapPath("~") + "\\Resumes\\" + "SVCM-00002.doc";
object file = location;
object nullobj = System.Reflection.Missing.Value;
Word.Document doc = (Word.Document)(wordApp.Documents.Add(ref file, ref nullobj, ref nullobj, ref nullobj));
string ss = doc.Content.Text;
doc.ActiveWindow.Selection.WholeStory();
doc.ActiveWindow.Selection.Copy();
//IDataObject data = Clipboard.GetDataObject();
//TextBox1.Text = data.GetData(DataFormats.Text).ToString();
TextBox1.Text = doc.ToString();

推荐答案

请参阅以下文章:
http://www.c-sharpcorner.com/UploadFile/Globalking/fileAccessingusingcsharp02242006050050AM/fileAccessingusingcsharp02.aspx [ ^ ]

直接从Microsoft Word文件中读取文档文本 [ ^ ]
Refer to these articles:
http://www.c-sharpcorner.com/UploadFile/Globalking/fileAccessingusingcsharp02242006050207AM/fileAccessingusingcsharp.aspx[^]

Read Document Text Directly from Microsoft Word File[^]


这篇关于从服务器的asp.net中的msword文件读取文本内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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