以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  专业报表打印边框  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=80796)

--  作者:kaituozhe
--  发布时间:2016/2/1 18:12:00
--  专业报表打印边框

以下代码是窗口中所有可打印控件,能否只包括某一类控件,比如textbox  

For Each c As Object In doc.body.children

 

另外WinForm.后面的类型从那里找,帮助里找不到


--  作者:kaituozhe
--  发布时间:2016/2/1 18:49:00
--  
For Each c As Object In doc.body.children
    If typeof c Is prt.RenderText Then
        Dim nms() As String = {"序号:","类型:"}
        For Each nm As String  In nms
            If c.text Like nm  = False Then
                \'If c.Text Like "序号:" = False AndAlso c.Text Like "类型:" = False AndAlso c.Text Like "户名:" = False  AndAlso c.Text Like "身份证号" = False AndAlso c.Text Like "联系电话:" = False AndAlso c.Text Like "是否解决:" = False AndAlso c.Text Like "结果日期:" = False AndAlso c.Text Like "责任人:" = False Then
                c.Style.Borders.All = New prt.Linedef(0.5, Color.black)
               
            End If
        Next
    End If
Next
能否使用数组,用循环语句排除不需要边框的项

--  作者:大红袍
--  发布时间:2016/2/1 20:01:00
--  
以下是引用kaituozhe在2016/2/1 18:12:00的发言:

以下代码是窗口中所有可打印控件,能否只包括某一类控件,比如textbox  

For Each c As Object In doc.body.children

 

另外WinForm.后面的类型从那里找,帮助里找不到

 

Dim doc As PrintDoc = e.Form.GernatePrintDoc()
For Each c As Object In doc.body.children
    If typeof c Is prt.RenderText Then
        For i As Integer = 0 To c.Cols.Count - 1 \'逐列设置和填入内容
            c.cols(i).Style.TextAlignHorz = prt.AlignHorzEnum.Center
            c.cols(i).style.TextAlignVert = prt.AlignVertEnum.Center
        Next
    End If
Next
doc.Preview()

 


--  作者:大红袍
--  发布时间:2016/2/1 20:03:00
--  
For Each c As Object In doc.body.children
    If typeof c Is prt.RenderText Then
        Dim nms() As String = {"序号:","类型:"}
        Dim flag As Boolean = False
        For Each nm As String  In nms
            If c.text Like nm Then
                flag = True
                Exit For
            End If
        Next
        If flag = False Then
            c.Style.Borders.All = New prt.Linedef(0.5, Color.black)
        End If
    End If
Next