日期:2014-05-17  浏览次数:20383 次

坐等高手求教EXCEL
介绍一个导出复杂的EXCEL 

我之前用的是页面输出
HTML code

<html xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office'
xmlns:x='urn:schemas-microsoft-com:office:excel' xmlns='http://www.w3.org/TR/REC-html40'>
<head>
    <meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
    <!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name></x:Name><x:WorksheetOptions><x:Selected/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->
    <style type='text/css'>
        .td
        {
            width: 84px;
        }
        .gdtjContainer .tb tr
        {
            text-align: center;
            vertical-align: middle;
        }
        .gdtjContainer .tb th
        {
            border-right: 0.5pt solid #000;
            border-bottom: 0.5pt solid #000;
            text-align: center;
            font-weight: normal;
            font-size: 10pt;
            vertical-align: middle;
            height:18px;
        }
        .gdtjContainer .header th
        {
            font-size: 12pt;
        }
        .gdtjContainer .tb tr th.noleftborder
        {
            border-left: none;
        }
        .gdtjContainer .tb tr th.rightborder
        {
            border-right: 0.5pt solid #000;
        }
        .mainrow
        {
            height:35px;
        }
    </style>
</head>


这样不能设置单元格的属性。

------解决方案--------------------
"这样不能设置单元格的属性。" ?

请描述清晰,是指CSS不生效吗?

如下:

HTML code

<html xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office'
xmlns:x='urn:schemas-microsoft-com:office:excel' xmlns='http://www.w3.org/TR/REC-html40'>
<head>
    <meta http-equiv='Content-Type' content='text/html; charset=gb2312' />
    <!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name></x:Name><x:WorksheetOptions><x:Selected/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]-->
    <style type='text/css'>
        .td
        {
            width: 84px;
            color: red;
        }
        .gdtjContainer .tb tr
        {
            text-align: center;
            vertical-align: middle;
        }
        .gdtjContainer .tb th
        {
            border-right: 0.5pt solid #000;
            border-bottom: 0.5pt solid #000;
            text-align: center;
            font-weight: normal;
            font-size: 10pt;
            vertical-align: middle;
            height: 18px;
        }
        .gdtjContainer .header th
        {
            font-size: 12pt;
        }
        .gdtjContainer .tb tr th.noleftborder
        {
            border-left: none;
        }
        .gdtjContainer .tb tr th.rightborder
        {
            border-right: 0.5pt solid #000;
        }
        .mainrow
        {
            height: 35px;
        }
    </style>
</head>
<body>
    <table>
        <tr>
            <td class="td">
                test
            </td>
        </tr>
    </table>
</body>
</html>

------解决方案--------------------
我现在用的NPOI感觉很不错,导入导出很好用
------解决方案--------------------
渡娘地址http://www.cnblogs.com/tonyqus/archive/2009/03/16/1409966.html