Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / December 2005

Tip: Looking for answers? Try searching our database.

Export .Net

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dianna - 24 Dec 2005 01:55 GMT
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
Pandurang Nayak - 26 Dec 2005 15:42 GMT
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

Signature

blog: www.thinkingMS.com/pandurang

> Hi,
>
[quoted text clipped - 6 lines]
>
> Dianna

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.