通过Excel支持的Html元素 [英] Supported Html elements by Excel

查看:177
本文介绍了通过Excel支持的Html元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我发现如果你把一些html标记保存为一个xls,它会在Excel中打开,所有的样式都很好。示例



myfile.xls

 < table> 
< tr>
< td style =background:red; text-align:center; border:1px solid;>< h1> Blah< / h1>< / td>
< td style =background:red; text-align:left; font-weight:bold> Blah< / td>
< / tr>
< tr>
< td> 3221312dsdasd< / td>
< td> haha​​h2123dedaah< / td>
< / tr>
< tr>
< td> 123456< / td>
< td> haha​​h2123dedaah< / td>
< / tr>
< / table>

我想知道有没有关于什么HTML和CSS Excel支持的任何文档它没有?我尝试使用Google,真的找不到。我最感兴趣的是创建多个工作表。

解决方案

有关使用示例创建Excel文件的HTML方法的一些深入信息代码见 http://www.c-sharpcorner.com/UploadFile/kaushikborah28/79Nick08302007171404PM/79Nick。 aspx



还可以在 http://msdn.microsoft.com/en-us/library/Aa155477%28office.10%29.aspx



创建Excel文件的其他选项:



MS提供OpenXML SDK V 2.0 - 请参阅 http://msdn.microsoft.com/en-us/library/bb448854%28office.14%29.aspx



这可以读+写MS Office文件(包括Excel)。



另一个选项见 http://www.codeproject.com/KB/office/OpenXML.aspx



如果您需要更多的渲染,公式等,那么有不同的免费和商业图书馆,如 ClosedXML EPPlus Aspose.Cells SpreadsheetGear LibXL Flexcel 等。


Recently I found out that if you save some html markup as an xls it will open up in Excel just fine with all your styling. Example

myfile.xls

<table>
        <tr>
            <td style="background: red;text-align:center;border:1px solid;"><h1>Blah</h1></td>
            <td style="background: red;text-align:left;font-weight:bold;">Blah</td>
        </tr>
        <tr>
            <td>3221312dsdasd</td>
            <td>hahah2123dedaah</td>
        </tr>
        <tr>
            <td>123456</td>
            <td>hahah2123dedaah</td>
        </tr>
</table>

I was wondering if there is any kind of documentation on this about what html and CSS Excel supports and what it doesn't? I tried using Google and really couldn't find much. I was mostly interested in creating multiple worksheets.

解决方案

For some in-depth information regarding the HTML approach to creating Excel files with sample code see http://www.c-sharpcorner.com/UploadFile/kaushikborah28/79Nick08302007171404PM/79Nick.aspx

Also checkout the official documentation at http://msdn.microsoft.com/en-us/library/Aa155477%28office.10%29.aspx

Other options to create Excel files:

MS provides the OpenXML SDK V 2.0 - see http://msdn.microsoft.com/en-us/library/bb448854%28office.14%29.aspx

This can read+write MS Office files (including Excel).

Another option see http://www.codeproject.com/KB/office/OpenXML.aspx

IF you need more like rendering, formulas etc. then there are different free and commercial libraries like ClosedXML, EPPlus, Aspose.Cells, SpreadsheetGear, LibXL and Flexcel etc.

这篇关于通过Excel支持的Html元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆