How to read the .doc or .rtf file which is uploaded using file upload asp control and when submit it should display the content in Label using c# in asp.net.i used microsoft office dll but exception raises. if i will use stream reader and file stream class then some rectangle boxes are coming in place of empty space.pls give me some idea about it. i saw ur site but there also exception raises.i am trying also register that dll in own computer but some warning cames that :-this dll or path id doesn't exist ...so what should i do...?
Thank you
Loading
Alex SmithPosted Sep 9, 2014, 2:19 AM
This article that demonstrates a C# solution to open word read mode and load word from stream via C# word control may be helpful for this situation.
http://www.e-iceblue.com/Tutorials/Spire.Doc/Spire.Doc-Program-Guide/NET-Open-Word-Solutions-to-Open-Word-in-C-and-VB.NET.html
Darren KangPosted Sep 8, 2014, 4:53 AM
I'm not 100% sure, but it sounds like you are referencing one MS Office DLL but you have another one installed on your machine (or maybe you do not have MS Office at all on your local machine).
Note that in order to work with word interop in C# you need a reference to PIA, Amit link shows you a use of "Microsoft Word 9.0 object library" which is an older PIA (maybe MS Office 2000). In short you need to use the same PIA for development and deployment, you can find PIA list here.
Also if interested you can try an alternative approach and use this C# library to process your word files. You can manipulate with RTF file format in C# and with DOC file format in C# and with DOCX file format in C#, all in same manner.
To retrieve the documents text all you need to do is call DocumentModel.Load static method to read a file and then access its text through objects DocumentModel.Content.ToString().
Amit ChoudharyPosted Apr 20, 2010, 2:39 AM
Check out the article on the below link... will explain you how to read a .doc file using Interop dll of microsoft.
http://www.c-sharpcorner.com/UploadFile/Globalking/fileAccessingusingcsharp02242006050207AM/fileAccessingusingcsharp.aspx
Please mark as answer if it helps.