⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uqianbao.ctl

📁 公文管理系统》是一套通过行文收发
💻 CTL
📖 第 1 页 / 共 2 页
字号:
         Index           =   1
         Left            =   1200
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   2
         Top             =   2490
         Width           =   6615
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H8000000A&
         Caption         =   "签报"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   21.75
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   525
         Left            =   1320
         TabIndex        =   6
         Top             =   660
         Width           =   6135
      End
      Begin VB.Line Line1 
         BorderColor     =   &H000000FF&
         BorderWidth     =   2
         X1              =   1200
         X2              =   7770
         Y1              =   1410
         Y2              =   1410
      End
      Begin VB.Label lblLabels 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H8000000A&
         Caption         =   "标题:"
         ForeColor       =   &H80000008&
         Height          =   180
         Index           =   0
         Left            =   480
         TabIndex        =   5
         Top             =   1860
         Width           =   450
      End
      Begin VB.Label lblLabels 
         Appearance      =   0  'Flat
         AutoSize        =   -1  'True
         BackColor       =   &H8000000A&
         Caption         =   "内容:"
         ForeColor       =   &H80000008&
         Height          =   180
         Index           =   1
         Left            =   480
         TabIndex        =   4
         Top             =   2880
         Width           =   450
      End
   End
End
Attribute VB_Name = "UQianBao"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Public pIP As String
Public pConn As String
Dim strUserName As String


Private Sub cmdPrint_Click()
    Dim oWrd As Object, i As Integer
    Set oWrd = CreateObject("Word.Application")
    oWrd.Visible = True
    oWrd.Activate
    oWrd.Documents.Add

    With oWrd.ActiveDocument.PageSetup
        .TopMargin = 72
        .BottomMargin = 72
        .LeftMargin = 66
        .RightMargin = 66
        .Gutter = 28.35
        .HeaderDistance = 42.55
        .FooterDistance = 47
        .PageWidth = 595.3
        .PageHeight = 841.9
    End With
    
    With oWrd.Selection
      
      For i = 1 To 28
        .TypeParagraph
      Next i
      
      With .ParagraphFormat
        .Alignment = 3
        .LineSpacingRule = 4
        .LineSpacing = 42
      End With
      
      .ParagraphFormat.Alignment = 1
      .Font.Size = 16    '三号
      .Font.Name = "宋体"
      .Font.Bold = True
      .TypeText txtFields(0).Text
      .TypeParagraph
            
      .ParagraphFormat.Alignment = 3
      .Font.Size = 14     '四号
      .Font.Name = "宋体"
      .Font.Bold = False

      .TypeText txtFields(1).Text
      .TypeParagraph
    End With

    oWrd.ActiveWindow.ActivePane.View.Type = 3
    oWrd.ActiveWindow.ActivePane.View.SeekView = 10

     
'     With oWrd.Selection.ParagraphFormat
'        .Borders(-3).LineStyle = 0
'    End With
'

    
    With oWrd.Selection
      .ParagraphFormat.Alignment = 3
      .ParagraphFormat.LeftIndent = 330
      .Font.Size = 14
      .Font.Name = "宋体"
      .Font.Bold = False
      
    End With
    
    With oWrd.Selection
        .Fields.Add Range:=oWrd.Selection.Range, Type:=33
'        .TypeText Space(7)
'        .Fields.Add Range:=oWrd.Selection.Range, Type:=26
    End With
    
    oWrd.ActiveWindow.ActivePane.View.SeekView = 0
    
    oWrd.ActiveDocument.Sections(2).Range.Paragraphs.LineSpacingRule = 0

    
    
    oWrd.Selection.HomeKey unit:=6
    
    Set oWrd = Nothing

End Sub

Private Sub datPrimaryRS_Error(ByVal ErrorNumber As Long, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, fCancelDisplay As Boolean)
  '错误处理程序代码置于此处
  '想要忽略错误,注释掉下一行
  '想要捕获它们,在此添加代码以处理它们
  MsgBox "Data error event hit err:" & Description
End Sub

Private Sub datPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
  '为这个 recordset 显示当前记录位置
  datPrimaryRS.Caption = "记录: " & CStr(datPrimaryRS.Recordset.AbsolutePosition)
End Sub

Private Sub datPrimaryRS_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
  '验证代码置于此处
  '下列动作发生时该事件被调用
  Dim bCancel As Boolean

  Select Case adReason
  Case adRsnAddNew
  Case adRsnClose
  Case adRsnDelete
  Case adRsnFirstChange
  Case adRsnMove
  Case adRsnRequery
  Case adRsnResynch
  Case adRsnUndoAddNew
  Case adRsnUndoDelete
  Case adRsnUndoUpdate
  Case adRsnUpdate
  End Select

  If bCancel Then adStatus = adStatusCancel
End Sub

Private Sub cmdAdd_Click()
  On Error GoTo AddErr
  datPrimaryRS.Recordset.AddNew

  Exit Sub
AddErr:
  MsgBox Err.Description
End Sub

Private Sub cmdDelete_Click()
  On Error GoTo DeleteErr
  With datPrimaryRS.Recordset
    .Delete
    .MoveNext
    If .EOF Then .MoveLast
  End With
  Exit Sub
DeleteErr:
  MsgBox Err.Description
End Sub

Private Sub cmdRefresh_Click()
  '只有多用户应用程序需要
  On Error GoTo RefreshErr
  datPrimaryRS.Refresh
  Exit Sub
RefreshErr:
  MsgBox Err.Description
End Sub

Private Sub cmdUpdate_Click()
  On Error GoTo UpdateErr

  datPrimaryRS.Recordset.UpdateBatch adAffectAll
  Exit Sub
UpdateErr:
  MsgBox Err.Description
End Sub

Private Sub UserControl_Initialize()
    pConn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=OA;Data Source=lzy"
    
    strUserName = GetSetting("JGYOA", "Login", "UserName", "")
    
    With datPrimaryRS
        .ConnectionString = pConn
        .RecordSource = "select ID, 标题, 内容, username from 签报 where username='" & strUserName & "' Order by ID"
        .Refresh
    End With
End Sub

Private Function Title(ts As String) As String
    Dim rs As New ADODB.Recordset
    Dim a, b As String
    
    rs.Open "select * from 公文格式表 where 公文类别 = '" & ts & "'", pConn, adOpenDynamic, adLockReadOnly
    a = rs.Fields("单位名称").Value
    b = rs.Fields("公文类别").Value
    rs.Close
    Set rs = Nothing
    Title = a & b
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -