导出到excel标题下划线不起作用 [英] Export to excel header underline is not working

查看:140
本文介绍了导出到excel标题下划线不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从gridview导出到excel的选择列,excel标题前白色和背面颜色带蓝色但是标题下的标题不适用于我的Excel工作表吗?请建议这个



selected column exported from gridview to excel ,excel header fore color with white and back color with blue but header under line is not applying to my excel sheet?please advice on this

GridView1.HeaderRow.ForeColor = Drawing.Color.White
GridView1.HeaderRow.BackColor = Drawing.Color.FromArgb(75, 130, 201)
GridView1.HeaderStyle.Font.Underline = True
 
GridView1.HeaderRow.Style.Add("text-decoration", "Underline")
For Each cell As TableCell In GridView1.HeaderRow.Cells
   cell.BackColor = GridView1.HeaderStyle.BackColor
   cell.ForeColor = GridView1.HeaderStyle.ForeColor
   GridView1.HeaderStyle.Font.Underline = True
   GridView1.HeaderRow.Cells(0).Style.Add("text-decoration", "Underline")
Next
 
For Each row As GridViewRow In GridView1.Rows
   For Each cell As TableCell In row.Cells
      If row.RowIndex Mod 2 = 0 Then
         row.BackColor = Drawing.Color.FromArgb(235, 235, 235)
         cell.BackColor = GridView1.AlternatingRowStyle.BackColor
      Else
         row.BackColor = Drawing.Color.FromArgb(211, 211, 211)
         cell.BackColor = GridView1.RowStyle.BackColor
      End If
      cell.CssClass = "textmode"
   Next
Next
GridView1.RenderControl(hw)

Dim style As String = "<style> .textmode { } </style>"
Response.Write(style)
Response.Output.Write(sw.ToString())
Response.Flush()
Response.[End]()

推荐答案

尝试

使用C#和VB.Net将格式导出到ASP.Net中的Excel格式 [ ^ ]


这篇关于导出到excel标题下划线不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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