可不可以吧CSS 变成文件 上面引用绝对路径。
导出的时候引用路径参考

解决方案 »

  1.   

    我的导出代码里面就没CSS样式,错误的样式,是控制HTML页面的
      

  2.   

    -。- 我哭啊,我的 excel  是用代码画表划成的,里面根本没用到 main.css,样式,,即使,我把main.css删掉,他也会提示,css文件夹里面,别的css错误,我在这个项目遇到这个问题,但是在别的项目上,就没出现,代码直接能用。
      

  3.   

    -.- 我就郁闷死了,我做别的项目,这个代码直接放上去,就能用,页面也引用了CSS,名字都是一样的,,但是就做这个项目,出这个问题,,郁闷死了
      

  4.   

    Myxls
    用这个excel导出组件试试
    public static void ExportToTable(System.Data.DataTable dtData, string filename)
            {
                XlsDocument xls = new XlsDocument();
                Worksheet sheet = xls.Workbook.Worksheets.AddNamed(filename);//状态栏标题名称            int rowNum = dtData.Rows.Count;            int columnNum = dtData.Columns.Count;            int rowIndex = 1;            int columnIndex = 0;            //生成格式列
                ColumnInfo colInfo = new ColumnInfo(xls, sheet);
                colInfo.ColumnIndexStart = 0;
                colInfo.ColumnIndexEnd = Convert.ToUInt16(columnNum);
                colInfo.Width = 20 * 256;            sheet.AddColumnInfo(colInfo);            //绑定标题
                Cell cell = null;
                foreach (DataColumn dc in dtData.Columns)
                {
                    columnIndex++;                cell = sheet.Cells.AddValueCell(rowIndex, columnIndex, dc.ColumnName);
                    //cell.HorizontalAlignment = HorizontalAlignments.Centered;
                    //cell.Font.Weight = FontWeight.Bold;
                    //cell.PatternColor = Colors.Default30;
                    //cell.RightLineColor = Colors.Black;
                    //cell.RightLineStyle = 1;
                    //cell.BottomLineColor = Colors.Black;
                    //cell.BottomLineStyle = 1;
                    //cell.TopLineColor = Colors.Black;
                    //cell.TopLineStyle = 1;                cell.HorizontalAlignment = HorizontalAlignments.Centered;
                    cell.VerticalAlignment = VerticalAlignments.Centered;
                    cell.Pattern = 1;
                    cell.PatternColor = Colors.EgaBlue;
                    cell.UseBorder = true;
                    cell.TopLineStyle = 1;
                    cell.TopLineColor = Colors.Black;
                    cell.BottomLineStyle = 1;
                    cell.BottomLineColor = Colors.Black;
                    cell.LeftLineStyle = 1;
                    cell.LeftLineColor = Colors.Black;
                    cell.RightLineStyle = 1;
                    cell.RightLineColor = Colors.Black;
                    cell.Font.Bold = true;
                    cell.Font.Height = 11 * 20;
                    cell.Font.ColorIndex = 1;            }            //绑定子项数据
                for (int i = 0; i < rowNum; i++)
                {                rowIndex++;                columnIndex = 0;                for (int j = 0; j < columnNum; j++)
                    {                    columnIndex++;                    cell = sheet.Cells.AddValueCell(rowIndex, columnIndex, dtData.Rows[i][j].ToString());
                        cell.HorizontalAlignment = HorizontalAlignments.Centered;
                        cell.TextWrapRight = true;
                        cell.VerticalAlignment = VerticalAlignments.Top;
                        if (j == 0)
                        {
                            cell.LeftLineColor = Colors.Black;
                            cell.LeftLineStyle = 1;
                        }                    cell.RightLineColor = Colors.Black;
                        cell.RightLineStyle = 1;
                        cell.BottomLineColor = Colors.Black;
                        cell.BottomLineStyle = 1;                }            }            //导出
                xls.FileName = filename;
                xls.Send();
            }
      

  5.   

    -.- 最后找出问题了,,我是迅雷下载下来的,迅雷下下来的是页面,要用IE下载,那样才是EXCEL