ASP to Excel Image Alignment Problems

K

Kevin G.

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.
 
M

Mike Brind [MVP]

Kevin G. said:
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.....
 
D

Daniel Crichton

Kevin wrote on Wed, 1 Oct 2008 07:52:09 -0700 (PDT):
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!


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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top