导出HTML到Excel,而不会失去格式 [英] Exporting HTML to Excel Without Losing Formatting
问题描述
我有一个生成一个报告一个asp.net页面。无论是好是坏,整个事情是使用嵌套表格生成的。我能够导出页面到excel,但我失去了我所有格式(不能设置列宽等)。有没有一种方法来处理呢?我愿意补充说,需要它的HTML端的任何愚蠢的MS Office的特异性标记。
I have a asp.net page that generates a report. For better or for worse, the entire thing is generated using nested tables. I am able to export the page to excel, however I lose all my formatting (can't set column widths, etc). Is there a way to handle this? I'm open to adding any goofy MS Office -specific tags that are required to the html side of it.
如果这是不可行的,如果任何人有任何其他想法,要求是用户需要一个报告中指出:
If this isn't feasible and if anyone has any other ideas, the requirement is that users need a report that:
A),他们可以手动一些个性化/特定区域数据润色
a) They can manually touch up with some personalization / area-specific data
二)需要被隐藏/基于用户的位置显示列
b) Needs to be hide/show columns based on user's location
C)需要从网站上运行。
c) Needs to run from the web site.
任何帮助或建议另一种方法是大大AP preciated。
Any help or recommendations for an alternate approach would be greatly appreciated.
谢谢
乔
推荐答案
您真的不能没有第三方工具很遗憾。
You can't really without a third party tool unfortunately.
如果最终用户已知有办公室2007+那么你可以使用Open XML格式。
If the end users are known to have Office 2007+ then you can use open XML format.
如果你去第三方的路线,他们一般是相当昂贵的,至少为$ 130
If you go the third party route, they are generally quite expensive, at least $130
检查这个堆栈溢出线程
<一个href=\"http://stackoverflow.com/questions/153079/how-can-i-read-ms-office-files-in-a-server-without-installing-ms-office-and-wit\">How我可以读取服务器MS Office文件,而无需安装MS Office和不使用互操作的图书馆?
虽然可以隐藏在你的code出口前操纵列/显示列,这不是什么大不了的事,外观和感觉的只是格式将是困难的。
Although you can hide/show columns in your code to manipulate the columns before exporting, that's not a big deal, just the formatting of the look and feel will be difficult.
这篇关于导出HTML到Excel,而不会失去格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!