在asp.net中读取.pdf/.txt/.doc文件 [英] Reading .pdf/.txt/.doc file in asp.net

查看:83
本文介绍了在asp.net中读取.pdf/.txt/.doc文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在开发求职门户.求职者可以在此上传简历/简历.
当求职者想要查看或下载上载的简历时,我遇到问题.

我以前只能查看.doc文件,而不能查看pdf.
同样的问题是,.doc文件中的表格或行,图像在我的网页代码中没有显示.

这是我的代码. 请帮助我提供简单的代码.

Hi,

I am developing a job search portal. In this a job seeker can upload their resume/cv.
I am having a problem when job seeker want to view or download the uploaded resume/cv.

I have used to view only .doc file but not for pdf.
Also problem is that the table or lines, images which are in .doc file not shown by my code in web page.

Here is my code. Please help me with simple code.

if (System.IO.File.Exists(filepath))
            {
                //using (StreamReader srd = new StreamReader(filepath))
                //{
                //    string lineno;
                //    while ((lineno=srd.ReadLine())!= null)
                //    {
                //        txtViewRes.Text+=""+lineno;
                //    }
                //}
                ApplicationClass wordApp = new ApplicationClass();
                object file = filepath;
                object nullobj = System.Reflection.Missing.Value;
                Microsoft.Office.Interop.Word.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,

      ref nullobj, ref nullobj, ref nullobj, ref nullobj);

                doc.ActiveWindow.Selection.WholeStory();

                doc.ActiveWindow.Selection.Copy();

                string sFileText = doc.Content.Text;

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

                wordApp.Quit(ref nullobj, ref nullobj, ref nullobj);

                txtViewRes.Text=sFileText;

推荐答案

请参见
See this[^] to see why your document formatting is not passed through.


这篇关于在asp.net中读取.pdf/.txt/.doc文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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