C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




how to open rtf file as text fileand then read that txt file C#.NET


Posted Date: 20 Jul 2008      Total Responses: 1

Posted By: spoorthi       Member Level: Gold     Points: 1



Hi All,

how to open rtf file as text file and then read in C#.NET

i need to open rtf file as txt file and then read the contents fom the txt file could anyone help me in this

Thank You,
Spoorthi





Responses

Author: Vidhya    22 Jul 2008Member Level: GoldRating:     Points: 1

protected void Submit1_ServerClick(object sender, EventArgs e)
{

Word.ApplicationClass wordApp = new Word.ApplicationClass();

<!--[if !supportEmptyParas]-->

// Input box is used to get the path of the file which ahas to be <!--[if !supportEmptyParas]-->uploaded into textbox.<!--[endif]-->

string filePath = inputbox.Value;

object<!--[if !supportEmptyParas]--> file = filePath; <!--[endif]-->

object nullobj = System.Reflection.Missing<!--[if !supportEmptyParas]-->.Value;<!--[endif]-->

<!--[if !supportEmptyParas]-->// here on Document.Open there should be 9 arg.<!--[endif]-->

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);<!--[if !supportEmptyParas]--> <!--[endif]-->

// Here the word content is copeied into a string which helps to store it into textbox.

Word.Document doc1 = wordApp.ActiveDocument;

string<!--[if !supportEmptyParas]--> m_Content = doc1.Content.Text;<!--[endif]-->

<!--[if !supportEmptyParas]-->// the content is stored into the textbox. <!--[endif]-->

m_Textbox.Text = m_Content;

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






Post Reply
You must Sign In to post a response.
Next : Datagridview get values from another Datagridview
Previous : how to open rtf file as text file and then read in C#.NET
Return to Discussion Forum
Post New Message
Category: Windows

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use