IT Community - Software Programming, Web Development and Technical Support

How to create html from the content of the textbox?

This is a discussion on How to create html from the content of the textbox? within the C# Programming forums, part of the Software Development category; Hi, I am doing the project of creating a html file from the content of the text box. Can any ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-27-2007, 03:04 AM
Balasubramanian.S Balasubramanian.S is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 182
Balasubramanian.S is on a distinguished road
Default How to create html from the content of the textbox?

Hi,

I am doing the project of creating a html file from the content of the text box. Can any one tell me how to create html file using c# with images?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-27-2007, 03:34 PM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Default Re: How to create html from the content of the textbox?

I dont get your question. I think you want to create a HTML editing functionality in C#.

ok that is what you want, you can use the WebBrowser component. It has property to enable edit functionality for the given HTML file. Using that component you can create a basic HTML file, you can enable functionality to change the font,size and images etc.

or If you want to parse a HTML file

study about the following components

HTMLLinkElement
MSHTML.HTMLDocument
MSHTML.HTMLDocument

I just gave an idea about your question. But it will be better to give a detailed explanation about your requirement.

thanks
__________________
Karpagarajan. R
Necessity is the mother of invention

Last edited by Karpagarajan : 03-27-2007 at 03:37 PM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-27-2007, 11:33 PM
Balasubramanian.S Balasubramanian.S is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 182
Balasubramanian.S is on a distinguished road
Default Re: How to create html from the content of the textbox?

Hi,

If I enter some text in a textbox in C#.NET, the content of a TextBox will be saved as a HTML file in a particular path.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-28-2007, 05:47 AM
Karpagarajan Karpagarajan is offline
D-Web Analyst
 
Join Date: Mar 2007
Posts: 299
Karpagarajan is on a distinguished road
Thumbs up Re: How to create html from the content of the textbox?

Quote:
Originally Posted by Balasubramanian.S View Post
Hi,

If I enter some text in a textbox in C#.NET, the content of a TextBox will be saved as a HTML file in a particular path.
Ahh...

Use the C# file class to write the textbox content in a HTML file with the following tag()

<html>
<head>
<title>textcontent</title>
<body bgcolor="#E3E3E3">
<h1>textcontent</h1>
</body>
</html>


C# file stream sample code

The following sample will write a html file from the console input text. You can change it with your own code.

FileStream strm;
// Open or create the file for writing
try
{
strm = new FileStream ("./write.html", FileMode.OpenOrCreate, FileAccess.Write);
}
// If the open fails, the constructor will throw an exception.
catch (Exception e)
{
Console.WriteLine (e.Message);
Console.WriteLine ("Cannot open write.html for writing");
return;
}
// Truncate the file using the SetLength() method.
strm.SetLength (0);
Console.WriteLine ("Enter text. Type a blank line to exit\r\n");
// Accept text from the keyboard and write it to the file.
while (true)
{
string str = Console.ReadLine ();
if (str.Length == 0)
break;
byte [] b; // = new byte [str.Length];
StringToByte (str, out b);
strm.Write (b, 0, b.Length);
}
Console.WriteLine ("Text written to write.html");
// Close the stream
strm.Close ();


if you want to display as your html predefined format, add your html content statically while writing the HTML file in C#.

hope I got your problem

thanks
__________________
Karpagarajan. R
Necessity is the mother of invention
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-29-2007, 08:30 AM
Balasubramanian.S Balasubramanian.S is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 182
Balasubramanian.S is on a distinguished road
Default Re: How to create html from the content of the textbox?

Many Thanks
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to assign html Content to RichText as a Normal Text? poornima ASP and ASP.NET Programming 3 03-10-2008 03:15 AM
How to do wordwrap the HTML content using javascript? ramkumaraol PHP Programming 9 11-22-2007 07:12 AM
How to do wordwrap the HTML content using javascript? ramkumaraol PHP Programming 0 11-14-2007 04:01 AM
How to create textbox without border? ramkumaraol PHP Programming 2 09-07-2007 06:13 AM
How to create an HTML Editor for ASP.NET AJAX Sundaram C# Programming 13 09-05-2007 01:16 AM


All times are GMT -7. The time now is 01:18 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0