Strategy in exporting to Excel with formatting from ASP.NET?
Posted
by Jiho Han
on Stack Overflow
See other posts from Stack Overflow
or by Jiho Han
Published on 2010-04-07T19:59:25Z
Indexed on
2010/04/07
20:03 UTC
Read the original article
Hit count: 402
So this is another exporting to Excel question.
I have a page that has a table with formatting by stylesheet. When I export the page by setting the ContentType to application/excel and Content-Disposition to attachment, I can export the table to Excel (not CSV). However, it loses all formatting. I think it's because Excel does not load CSS and I guess that's reasonable.
So, in a scenario where I have to show the table on the web and also export to Excel, both with similar (even if not exact) formatting, what would be the best approach without using something like NPOI?
I am trying to minimize the work and keep the single template if possible. Is it necessary for me to create two separate templates: one with stylesheet, the other with embedded style in the table itself for Excel?
Having a single template with conditional formatting inside would be very messy.
Any ideas?
© Stack Overflow or respective owner