I am using the dsoframer control from microsoft (unsupported control)
see
http://support.microsoft.com/?kbid=311765
It works as expected I can embed a word document in my windows forms application. I would like to be able to turn off and on particular toolbars. The control provides for a global toolbars property which seems to turn on and off the toolbars all of them.
In theory the following should work in my code below but it does not seem to have any affect.
oDoc.Application.CommandBa
rs("Format
ting").Vis
ible = True
Any help would be greatly appreciated.
Public Sub New(ByVal memo As String)
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Try
Me.t_Memo.Text = memo
If My.Settings.WordAsEditor = True Then
fc_Memo.CreateNew("Word.Do
cument")
fc_Memo.Visible = True
fc_Memo.Dock = DockStyle.Fill
fc_Memo.BringToFront()
fc_Memo.set_EnableFileComm
and(DSOFra
mer.dsoFil
eCommandTy
pe.dsoFile
New, False)
fc_Memo.set_EnableFileComm
and(DSOFra
mer.dsoFil
eCommandTy
pe.dsoFile
Open, False)
fc_Memo.Toolbars = True
' We need to explicitly enable the event sinks. Due to a strange bug in .NET
' when the control is sited to tab page and not the main form, it is told to
' freeze events (IOleControl) but never told to unfreeze. So events don't get
' fired correctly from tab strip. This sets the flag to re-enable the events.
fc_Memo.EventsEnabled = True
fc_Memo.Select()
Me.t_Memo.Visible = False
oDoc = fc_Memo.ActiveDocument
With oDoc
.ActiveWindow.DisplayRight
Ruler = False
.ActiveWindow.DisplayScree
nTips = False
.ActiveWindow.DisplayVerti
calRuler = False
.ActiveWindow.ActivePane.D
isplayRule
rs = False
.ActiveWindow.ActivePane.V
iew.Type = Microsoft.Office.Interop.W
ord.WdView
Type.wdWeb
View
End With
oWord = oDoc.Application
oDoc.Content.Text = memo
End If
'Try
' oDoc.Application.CommandBa
rs("QuickT
ool").Visi
ble = True
'Catch ex As Exception
' ShowMessage(1, MessageType.UnhandledError
, , ex)
'End Try
Try
oDoc.Application.CommandBa
rs("Standa
rd").Visib
le = False
Catch ex As Exception
ShowMessage(1, MessageType.UnhandledError
, , ex)
End Try
Try
oDoc.Application.CommandBa
rs("Format
ting").Vis
ible = True
Catch ex As Exception
ShowMessage(1, MessageType.UnhandledError
, , ex)
End Try
Catch ex As Exception
ShowMessage(1, MessageType.UnhandledError
, , ex)
End Try
End Sub
Following code worked for me
AxFramerControl1 is the dsoFramer control name
Open in new window