ASP to Excel Image Alignment Problems

Discussion in 'ASP General' started by Kevin G., Oct 1, 2008.

  1. Kevin G.

    Kevin G. Guest

    Hello,

    I'm exporting an ASP page to Excel using 'Response.ContentType =
    "application/vnd.ms-excel"' and it is working fine for the most part
    except the particular page I'm exporting has images, and no matter
    what style/alignment/etc. that I provide to the <td> tag that
    contains
    the <img> tag, it always left-aligns the image in the Excel cell.
    Has anyone had any success with controlling the alignment of images
    when exporting from ASP to Excel using
    'Response.ContentType = "application/vnd.ms-excel"'? If so, would
    you
    be willing to share your secret?

    Thanks in advance!

    Kevin G.
    Kevin G., Oct 1, 2008
    #1
    1. Advertising

  2. "Kevin G." <> wrote in message
    news:...
    > Hello,
    >
    > I'm exporting an ASP page to Excel using 'Response.ContentType =
    > "application/vnd.ms-excel"' and it is working fine for the most part
    > except the particular page I'm exporting has images, and no matter
    > what style/alignment/etc. that I provide to the <td> tag that
    > contains
    > the <img> tag, it always left-aligns the image in the Excel cell.
    > Has anyone had any success with controlling the alignment of images
    > when exporting from ASP to Excel using
    > 'Response.ContentType = "application/vnd.ms-excel"'? If so, would
    > you
    > be willing to share your secret?
    >


    Create a Workbook yourself as you would ideally have it, then save it as a
    web page. You can open the resulting .htm file in NotePad or similar and
    see the source that has been generated - including all the styles. Then use
    that as the template for your generated file.

    Now the secret's out.....

    --
    Mike Brind
    MVP - ASP/ASP.NET
    Mike Brind [MVP], Oct 1, 2008
    #2
    1. Advertising

  3. Kevin wrote on Wed, 1 Oct 2008 07:52:09 -0700 (PDT):

    > Hello,


    > I'm exporting an ASP page to Excel using 'Response.ContentType =
    > "application/vnd.ms-excel"' and it is working fine for the most part
    > except the particular page I'm exporting has images, and no matter what
    > style/alignment/etc. that I provide to the <td> tag that contains the
    > <img> tag, it always left-aligns the image in the Excel cell.
    > Has anyone had any success with controlling the alignment of images
    > when exporting from ASP to Excel using 'Response.ContentType =
    > "application/vnd.ms-excel"'? If so, would you be willing to share your
    > secret?


    > Thanks in advance!


    > Kevin G.



    Your MIME type is only causing IE to load the HTML you're sending into
    Excel - you're not actually sending an Excel file (so technically your MIME
    type is wrong). This is not an ASP issue, this is an Excel HTML conversion
    issue and you'd be better off asking on an Excel group or searching the web
    for articles on formatting HTML correctly for Excel to handle it the way
    you'd expect it to be handled.

    --
    Dan
    Daniel Crichton, Oct 2, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski
    Replies:
    2
    Views:
    442
    Eliyahu Goldin
    Jun 8, 2005
  2. =?Utf-8?B?U3JpZGhhcg==?=

    using Microsoft Excel image for Export to Excel button

    =?Utf-8?B?U3JpZGhhcg==?=, Dec 9, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    3,056
    =?Utf-8?B?U3JpZGhhcg==?=
    Dec 9, 2005
  3. Don@NoSpam

    Help with image/text alignment

    Don@NoSpam, May 30, 2004, in forum: HTML
    Replies:
    10
    Views:
    672
    Don@NoSpam
    Jun 2, 2004
  4. =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=

    Problem with Excel reports ::::Excel 2003 Migration To Excel 2007

    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=, Oct 5, 2007, in forum: ASP .Net
    Replies:
    15
    Views:
    1,469
    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=
    Oct 24, 2007
Loading...

Share This Page