Foxtable(狐表)用户栏目专家坐堂 → [求助]导出excle分组统计字体颜色和加粗


  共有4436人关注过本帖平板打印复制链接

主题:[求助]导出excle分组统计字体颜色和加粗

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/10/4 11:25:00 [只看该作者]

Dim tt As Table = Tables("室内设计项目")
Dim file As String = "d:\我的项目.xls"
Dim flg As New SaveExcelFlags
flg.CellStyle = True
For Each c As Col In tt.Cols
    c.TextAlign = TextAlignEnum.Center
Next
tt.SaveExcel(file ,tt.name,flg)


Dim Book As New XLS.Book(file)
Dim Sheet1 As XLS.Sheet = Book.Sheets(0)
Dim Style As XLS.Style = Book.NewStyle() '定义新样式
Style.ForeColor = Color.Red '设置样式的字体颜色
Style.FontBold = True

Style.BackColor = Color.DodgerBlue
Style.BorderTop = XLS.LineStyleEnum.None
Style.BorderBottom = XLS.LineStyleEnum.None
Style.BorderLeft = XLS.LineStyleEnum.None
Style.BorderRight = XLS.LineStyleEnum.None


Dim Style2 As XLS.Style = Book.NewStyle() '定义新样式
Style2.BorderTop = XLS.LineStyleEnum.Thin
Style2.BorderBottom = XLS.LineStyleEnum.Thin
Style2.BorderLeft = XLS.LineStyleEnum.Thin
Style2.BorderRight = XLS.LineStyleEnum.Thin
Style2.BorderColorTop = Color.red
Style2.BorderColorBottom = Color.red
Style2.BorderColorLeft = Color.red
Style2.BorderColorRight = Color.red

For n As Integer = 1 To Sheet1.Rows.Count -1
    If Sheet1(n,6).Value = "1" Then
        Sheet1(n,6).Value = "√"
    Else
        Sheet1(n,6).Value = ""
    End If
    If Sheet1(n,1).Value.contains("地址") Then
        If n > 2 Then
            For c As Integer = 0 To 9
                Sheet1 (n,c).Style = Style
            Next
        End If
    Else
        For c As Integer = 0 To 9
            'Sheet1 (n,c).Style = Style2
        Next
        'Sheet1(n,0).Style = Style2
    End If
Next


Book.Save(file)
Dim Proc As New Process
Proc.File = file
Proc.Start()


 回到顶部
总数 25 1 2 3 下一页