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

📄 ufawengaozhi.ctl

📁 公文管理系统》是一套通过行文收发
💻 CTL
📖 第 1 页 / 共 5 页
字号:
      .TypeParagraph
      
      '抄送机关、附件
      .TypeText txtFields(12).Text & vbTab & txtFields(13).Text
      .TypeParagraph
      
      '主题词
      .TypeText txtFields(14).Text
      .TypeParagraph
      
      
      
      With .ParagraphFormat
        .SpaceBefore = 0
        .SpaceAfter = 0
        .LineSpacingRule = 4
        .LineSpacing = 66
        .LeftIndent = 0
      End With

      .TypeParagraph
      
      '内容
      .ParagraphFormat.LineSpacing = 42.2
      
      .TypeText txtFields(10).Text & ":"
      .TypeParagraph
      .TypeText txtFields(21).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
        .SpaceBefore = 0
        .SpaceAfter = 0
        .LineSpacingRule = 0
        .FirstLineIndent = 0
        .LeftIndent = 335
    End With

    
    With oWrd.Selection
        .Font.Size = 14    '四号

        .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 cmdPrint1_Click()
    Dim oWrd As Object, i As Integer, s文件编号 As String
    
    s文件编号 = txtFields(15).Text & "字[" & txtFields(23).Text & "]" & Format(txtFields(16).Text, "000") & "号"
    
    Set oWrd = CreateObject("Word.Application")
    oWrd.Visible = True
    oWrd.Activate
    oWrd.Documents.Add
    
    
    
    With oWrd.ActiveDocument.PageSetup
        .TopMargin = 72
        .BottomMargin = 72
        .LeftMargin = 90
        .RightMargin = 90
        .HeaderDistance = 42.55
        .FooterDistance = 49.6
        .PageWidth = 595.3
        .PageHeight = 841.9
        
        .LinesPage = 24
'        .LayoutMode = 2
    
    End With

    
    
    With oWrd.Selection
      
      For i = 1 To 9
        .TypeParagraph
      Next i
      
      .ParagraphFormat.Alignment = 3
      .Font.Size = 14    '四号
      .Font.Name = "宋体"
      .Font.Bold = False
      .TypeText Space(18) & s文件编号
      
      If DataCombo1.Text <> "" Then
        .TypeText Space(4) & "签发人:" & DataCombo1.Text
      End If
      
      .TypeParagraph
      .TypeParagraph
      .TypeParagraph
      
      
      .ParagraphFormat.Alignment = 1
      .ParagraphFormat.SpaceBefore = 0
      .ParagraphFormat.LeftIndent = 39
      .ParagraphFormat.RightIndent = 39
      
      .Font.Size = 18    '小二号
      .Font.Name = "宋体"
      .Font.Bold = True
      .TypeText txtFields(9).Text
      .TypeParagraph
            
      .ParagraphFormat.Alignment = 3
      .ParagraphFormat.SpaceBefore = 0
      .ParagraphFormat.LeftIndent = 0
      .ParagraphFormat.RightIndent = 0
      
      .Font.Size = 14     '四号
      .Font.Name = "宋体"
      .Font.Bold = False
      
      .TypeParagraph

      
      
      .TypeText txtFields(10).Text & ":"
      .TypeParagraph
      .TypeText txtFields(21).Text
      .TypeParagraph
      .TypeParagraph

    
      
'      .ParagraphFormat.Borders(-1).LineStyle = 1
'      .ParagraphFormat.Borders(-1).LineWidth = 8
      
      .TypeText "主题词:" & txtFields(14).Text
      .TypeParagraph
      
      .ParagraphFormat.Borders(-1).LineStyle = 1
      .ParagraphFormat.Borders(-1).LineWidth = 8
      .ParagraphFormat.Borders(-3).LineStyle = 1
      .ParagraphFormat.Borders(-3).LineWidth = 8
      
      .TypeText "抄  送:" & txtFields(12).Text
      
    
    
    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 = 1
      .Font.Size = 14
      .Font.Name = "宋体"
      .Font.Bold = False
      
    End With
    
    With oWrd.Selection
        .TypeText "·"
        .Fields.Add Range:=oWrd.Selection.Range, Type:=33
        .TypeText "· "
'        .Fields.Add Range:=oWrd.Selection.Range, Type:=26
'        .TypeText " 页"
    End With
    
    oWrd.ActiveWindow.ActivePane.View.SeekView = 0
    
    oWrd.Selection.HomeKey unit:=6

    Set oWrd = Nothing
End Sub

Private Sub cmdReturn_Click()
    setVisible False
    If Not (datPrimaryRS.Recordset.BOF Or datPrimaryRS.Recordset.EOF) Then
        datPrimaryRS.Recordset.MoveFirst
        datPrimaryRS.Recordset.Bookmark = mvBookmark
    End If
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)
  '错误处理程序代码置于此处
  '想要忽略错误,注释掉下一行
  '想要捕获它们,在此添加代码以处理它们
'    If ErrorNumber = 3662 Then
'        MsgBox "'封发'前请输入日期,如 2001-1-1 或 2001/1/1 !", vbOKOnly + vbCritical, "提示信息"
'    End If
  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
'    If datPrimaryRS.Recordset.EditMode = adEditAdd Or datPrimaryRS.Recordset.EditMode = adEditInProgress Then
'        If MsgBox("信息已经更改,是否保存?", vbInformation + vbYesNo, "提示信息") = vbYes Then
'            cmdUpdate_Click
'        Else
'                atPrimaryRS.Recordset.CancelUpdate
'        End If
'    End If
  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
  cmdList.Enabled = False
  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
  cmdList.Enabled = True
  Exit Sub
RefreshErr:
  MsgBox Err.Description
End Sub

Private Sub cmdUpdate_Click()
  On Error GoTo UpdateErr
  datPrimaryRS.Recordset.Fields("username") = strUserName
  
  datPrimaryRS.Recordset.UpdateBatch adAffectAll
  cmdList.Enabled = True
  Exit Sub
UpdateErr:
  MsgBox Err.Description
End Sub

Private Sub DataGrid1_InitColumnProps()
    With DataGrid1
        .Columns(0).Caption = "ID"
        .Columns(11).Caption = "事由"
        .Columns(17).Caption = "发文字"
        .Columns(19).Caption = "发文号"
        .Columns(0).Width = 600
        .Columns(11).Width = 7000
        .Columns(17).Width = 1000
        .Columns(19).Width = 1000
    End With
End Sub

Private Sub txtFields_KeyPress(Index As Integer, KeyAscii As Integer)
    If Index = 17 Or Index = 22 Or Index = 23 Then
        If KeyAscii < 48 Or KeyAscii > 57 Then
            KeyAscii = 0
        End If
    End If
End Sub

Private Sub txtFields_LostFocus(Index As Integer)
    If Index = 20 Then
        If txtFields(Index).Text <> "" Then
            If Not IsDate(txtFields(Index).Text) Then
                MsgBox "'封发'前请输入日期,如 2001-1-1 或 2001/1/1 !", vbOKOnly + vbCritical, "提示信息"
                txtFields(Index).SelStart = 0
                txtFields(Index).SelLength = Len(txtFields(Index).Text)
                txtFields(Index).SetFocus
            End If
        End If
    End If
End Sub

Private Sub setVisible(blnVisible)
    DataGrid1.Visible = blnVisible
    cmdReturn.Visible = blnVisible
    cmdGoto.Visible = blnVisible
    picButtons.Visible = Not blnVisible
End Sub

Private Sub UserControl_Initialize()
    
    'lblLabels(0).Caption = Title("发文稿纸")
        
    strUserName = GetSetting("JGYOA", "Login", "UserName", Default:="")
    pConn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=OA;Data Source=lzy"
    
'    *********************************
'    strUserName = "aa"
'    *********************************
    
    With datPrimaryRS
        .ConnectionString = pConn
        .RecordSource = "select id,username,文件密级id,缓急,签发人id,复核,核稿,部门id,拟稿人,相关文件,会签,事由,主送机关,主送附件,抄送,抄送附件,主题词,发文字,年度,发文号,打印份数,打字,校对,封发日期,内容,页号 from 发文稿纸 where username='" & strUserName & "' ORDER BY ID; "
        .Refresh
    End With
    
    With Adodc1
        .ConnectionString = pConn
        .RecordSource = "签发人"
        .Refresh
    End With
    
    With DataCombo1
        Set .DataSource = datPrimaryRS
        .DataField = "签发人id"
        Set .RowSource = Adodc1
        .ListField = "签发人姓名"
        .BoundColumn = "签发人id"
    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 + -