.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani

Home >> Forum >> .NET Framework >> Post New QuestionBookmark and Share Subscribe to Forum

how to insert html tag in text file

Posted By: krishana singh     Posted Date: December 22, 2010    Points:2   Category :.NET Framework
my problem

i have text file in which 22 lines text..
first line convert into head tag
and other line convert into paragraph tag and line end set <br>
and export into html format...

please help..

Advance thanks

Author: Sunil Yadav       [Moderator]      
Posted Date: March 10, 2011     Points: 20   


Check out the below code snippet.

 TextReader textrdr = new StreamReader(@"C:\textfile.txt");
string header = textrdr.ReadLine(); //This reads the first line

string paragraph = textrdr.ReadToEnd(); // this reads the rest of lines

string htmlString = @"<html>" + header + "<body><p>" + paragraph + "</br></body></html>";

Hope this helps.

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend