AxDSOFramer.AxFramerControl

I am hosting an Excel spreadsheet in an instance of the AxDSOFramer.AxFramerControl object. There are properties to turn the menus, toolbar, and status bar on and off. However, there is no apparent way to control which menus are shown. If the Toolbars property is set to false, the Web Toolbar is shown. If it is set to true, the web, standard, and another toolbar are shown. Is there a way to control which toolbars are displayed Here is the code snippet...

private AxDSOFramer.AxFramerControl axFramerControl1;

axFramerControl1.Open(m_FileName, true, null, null, null);
axFramerControl1.Toolbars = false;
axFramerControl1.Titlebar = false;
axFramerControl1.Menubar = false;


Thanks for the help!

Mark.


Answer this question

AxDSOFramer.AxFramerControl

  • Tom_EM

    Hi Brian, It turns out that you can do it, but not with the AxDsoFramer control itself. You have to get the document object. it works the same for word, excel, or powerpoint docs. I have not tried other types. Here is sample code that first turns off all menus and then turns on Standard menu. My client wanted to limit the available buttons on the tool bar as well. This code does that.

    oDoc = axFramerControl1.ActiveDocument as Word.Document;

    for (int i = 1; i <= oDoc.CommandBars.Count; i++)

    {

    oDoc.CommandBarsIdea.Enabled = false;

    }

    oDoc.ActiveWindow.DisplayRulers = false;

    cmdBar = oDoc.CommandBars["Standard"];

    cmdBarCtrls = oDoc.CommandBars["Standard"].Controls;

    for (int i = 1; i <= cmdBarCtrls.Count; i++)

    {

    //Console.WriteLine(cmdBarCtrlsIdea.Caption);

    cmdBarCtrlsIdea.Visible = false;

    }

    cmdBar.Enabled = true;

    cmdBar.Visible = true;

    cmdBar.Protection = Microsoft.Office.Core.MsoBarProtection.msoBarNoCustomize;

    cmdBarCtrls["Copy"].Visible = true;

    cmdBarCtrls["Can't Undo"].Visible = true;

    cmdBarCtrls["Can't Redo"].Visible = true;

    cmdBarCtrls["Zoom:"].Visible = true;

    If you comment out the Console.Writeline statement you will see all of the possible buttons. You can alos add a Console.Writeline tot he top loop to see all of the available toolbars. I think the field name is "Name". Good Luck.


  • RamyaP

    MHR wrote:
    However, there is no apparent way to control which menus are shown. If the Toolbars property is set to false, the Web Toolbar is shown. If it is set to true, the web, standard, and another toolbar are shown. Is there a way to control which toolbars are displayed

    Mark,

    Did you ever find a solution

    Thanks,

    Brian


  • hasmukhkp

    Hi Mark,

    The DSOFramer control is for demo purpose, we did not provide support for it.

    NOTE: This sample is provided "AS IS" with no warranty or support from Microsoft. It is a demonstration, provided for informational purposes only, and has not been rigorously tested with all environments and ActiveX document servers. It is up to you to make it "production ready" if you use it in any development solution.

    Visual C++ ActiveX Control for hosting Office documents in Visual Basic or HTML
    http://support.microsoft.com/Default.aspx id=311765

    If you still have any concern, please feel free to post here.

    Best regards,
    Peter Huang



  • voodooflux

    Sorry for the ugliness above. The forum editor decided that it looked better that way. Anyway, the light bulb is really a [ then an i and then a ] with a . at the end. "Idea."
  • AxDSOFramer.AxFramerControl