1 Replies - 4688 Views - Last Post: 11 January 2011 - 03:45 AM Rate Topic: -----

#1 Guest_mark*


Append an Image with HtmlTextWriter

Posted 10 January 2011 - 05:50 PM

Trying to insert an image at the beginning of my customized excel output:

            Response.AddHeader("content-disposition", "attachment;filename=Report.xls");
            Response.ContentType = "application/vnd.ms-excel";
            Response.Charset = "";

            StringWriter stringWriter = new StringWriter();
            HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);

            stringWriter.WriteLine("Employee Report:  ");

Not sure if this can be done, by adding stringWriter.GetStringBuilder().Append("<div>") elements? How would it be done.

Is This A Good Question/Topic? 0

Replies To: Append an Image with HtmlTextWriter

#2 Nakor   User is offline

  • Professional Lurker
  • member icon

Reputation: 448
  • View blog
  • Posts: 1,504
  • Joined: 28-April 09

Re: Append an Image with HtmlTextWriter

Posted 11 January 2011 - 03:45 AM

I'm fairly sure this just isn't doable using this method. When you export the data to excel using the StringWriter it will create the img link but it won't have a local copy of the actual image to point to.

Might be doable using the excel interop library, but it's a little more complicated to use and I just don't have enough experience with it to be able to tell you that even that would for sure work.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1