By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 1,327 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

Export .Net

P: n/a
Hi,

I am using Response.ContentType = "application/vnd.ms-excel" to export an
asp page to excel. Nice feature, however, it does not seem to like style
sheets. Because of this, my excel file doesn't look as nice as my asp page.

Is there any way around this without re-writing page?
Any help would be great.

Dianna

Dec 24 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Dianna,

What you are doing is actually setting the MIME type of the ASP output to
the Excel MIME type. If the MIME type is registered on the computer on which
you are downloading this, it thinks that the output is actually an Excel file
and uses Excel to open the response.

While this works fine, remember that it is just Excel's ability to
"understand" a HTML-table based sheet that is helping you do this. Obviously
Excel does not understand style-sheets since it wasn't built for that.

To achieve this in your own style, you might want to have a HTML table with
embedded style content such as having your <font> tags and <td bgcolor..>
values all into the HTML code. You could have a seperate ASP file with this
HTML syntax (so as to not disturb your existing code) and redirect to that
for Excel download.

A more robust solution though is to do more realistic Excel code generation
by writing some code using the Excel automation objects. You will find sample
code for the same in MSDN or many other code sites. With your current means,
the file won't be recognized as Excel if your end-user does not have the
Excel MIME type registered on their computer for some reason.

Regards,
Pandurang

--
blog: www.thinkingMS.com/pandurang
"Dianna" wrote:
Hi,

I am using Response.ContentType = "application/vnd.ms-excel" to export an
asp page to excel. Nice feature, however, it does not seem to like style
sheets. Because of this, my excel file doesn't look as nice as my asp page.

Is there any way around this without re-writing page?
Any help would be great.

Dianna

Dec 26 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.