Thursday, May 10, 2012
Insert Image into HTML using C#
StringBuilder strBldr = new StringBuilder();
StringWriter strWriter = new StringWriter(strBldr);
HtmlTextWriter writer = new HtmlTextWriter(strWriter);
writer.RenderBeginTag(HtmlTextWriterTag.Html);
writer.RenderBeginTag(HtmlTextWriterTag.Head);
writer.RenderEndTag();
writer.AddStyleAttribute(HtmlTextWriterStyle.FontFamily, "Arial");
writer.AddStyleAttribute(HtmlTextWriterStyle.FontSize, "13");
writer.RenderBeginTag(HtmlTextWriterTag.Body);
writer.Write("Insert image into HTML.");
writer.WriteBreak();
writer.WriteBreak();
writer.Write("Your Image / Logo");
var img = new Image();
var hw = new HtmlTextWriter(Console.Out);
img.ImageUrl = "data.png";
img.RenderControl(writer);
writer.RenderEndTag();
writer.RenderEndTag();
string str = writer.InnerWriter.ToString();
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment