原創|其它|編輯:郝浩|2012-08-14 21:00:21.000|閱讀 588 次
概述:在VB語言的應用中,通過Edraw Office viewer component組件打開Word,Excel文件的方法
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
1、在“項目”菜單中選擇組件……
2、在控制表中選擇控制"Edraw Office Viewer Component Module"。
3、點擊OK按鈕。
4、控制將會出現在工具箱中。
5、將控制拖放到窗體中。
6、右鍵單擊控制然后選擇代碼視圖選項。
7、添加NotifyCtrlReady事件并加載庫文件。
Private Sub Command1_Click()
EDOffice1.OpenFileDialog
End Sub
Private Sub Command2_Click()
EDOffice1.SaveFileDialog
End Sub
Private Sub Command3_Click()
If EDOffice1.Toolbars = False Then
EDOffice1.Toolbars = True
Else
EDOffice1.Toolbars = False
End If
End Sub
Private Sub Command4_Click()
If EDOffice1.IsOpened = True Then
If EDOffice1.GetCurrentProgID = "Word.Application" Then
EDOffice1.ProtectDoc wdAllowOnlyFormFields
ElseIf EDOffice1.GetCurrentProgID = "Excel.Application" Then
EDOffice1.ProtectDoc XlProtectTypeNorma
End If
End If
End Sub
Private Sub Command5_Click()
EDOffice1.PrintDialog
End Sub
Private Sub EDOffice1_BeforeDocumentOpened()
''EDOffice1.SetValue "Password", "123"
''EDOffice1.SetValue "WritePassword", "456"
EDOffice1.DisableFileCommand wdUIDisalbeSave, True
EDOffice1.DisableFileCommand wdUIDisalbeSaveAs, True
EDOffice1.DisableFileCommand wdUIDisalbeSaveAsMenu, True
EDOffice1.DisableFileCommand wdUIDisalbePrint, True
EDOffice1.DisableFileCommand wdUIDisalbePrintQuick, True
End Sub
Private Sub EDOffice1_NotifyCtrlReady()
EDOffice1.LicenseName = ""
EDOffice1.LicenseKey = ""
End Sub
8 、運行項目。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:網絡資源整理