MS Office Forum / Word / Programming / February 2007
How to hide the Robbin in word 2007 programmable?
|
|
Thread rating:  |
kfengbest@gmail.com - 22 Jan 2007 06:39 GMT Hello all,
There is some requirement that using CHtmlView to open word document for previewing. In order to have the maximize preview area, the menu and toolbar should be hide. But for word 2007, how to hide the ribbon using C++?
It is appreciated for your response. Thanks.
Kaven.
Cindy M. - 25 Jan 2007 17:15 GMT Replied to duplicate question in one of the office.developer newsgroups.
Cindy Meister
kfengbest - 26 Jan 2007 13:18 GMT Actually nobody provided the real answer to this issue.
> Replied to duplicate question in one of the office.developer > newsgroups. > > Cindy Meister Patrick Schmid [MVP] - 26 Jan 2007 13:27 GMT Answer is: can't do.
Patrick Schmid [OneNote MVP] -------------- http://pschmid.net *** Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80 Office 2007 Beta 2 Technical Refresh (B2TR): http://pschmid.net/blog/2006/09/18/43 *** Customize Office 2007: http://pschmid.net/office2007/customize RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer OneNote 2007: http://pschmid.net/office2007/onenote *** Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
> Actually nobody provided the real answer to this issue. > > > Replied to duplicate question in one of the office.developer > > newsgroups. > > > > Cindy Meister kfengbest - 26 Jan 2007 14:14 GMT But what strange is that: 1. When drag and drop a doc file into IE, the document is opened with no ribbon! What has IE done internal? 2. Even I use CHtmlView to navigate a docx file which the ribbon is exsit, but when risize the window to be smaller enough, the ribbon will disappear too.
That means there is some possibility to hide ribbon but also the unpossibility-microsoft not provide the interface for programming.
Our software has wrapped CHtmlView into a COM for previewing all kinds of office document. It must hide all menu and toolbars for increase the viewing area and should support office XP\2003\2007. xp and 2003 is working well now, do you have any suggestion for 2007 in this case? Thank you very much.
> Answer is: can't do. > [quoted text clipped - 18 lines] >> > >> > Cindy Meister Patrick Schmid [MVP] - 26 Jan 2007 18:48 GMT > 2. Even I use CHtmlView to navigate a docx file which the ribbon is exsit, > but when risize the window to be smaller enough, the ribbon will disappear > too. That is a special feature of the ribbon. If you resize an Office app window to be narrower than 200-something pixels, the ribbon will hide itself fully automatically. The idea is that if the window is this small, you prob. don't want to do much more than see or edit the content and not be bothered with the UI.
Patrick Schmid [OneNote MVP] -------------- http://pschmid.net *** Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80 Office 2007 Beta 2 Technical Refresh (B2TR): http://pschmid.net/blog/2006/09/18/43 *** Customize Office 2007: http://pschmid.net/office2007/customize RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer OneNote 2007: http://pschmid.net/office2007/onenote *** Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
Tony Jollans - 26 Jan 2007 19:29 GMT I know nothing of CHtmlView but to maximize the viewing area you could use ..
(Window).View.FullScreen = True
That will turn the whole window over to document space - no ribbon in sight.
 Signature Enjoy, Tony
> But what strange is that: > 1. When drag and drop a doc file into IE, the document is opened with no [quoted text clipped - 35 lines] >>> > >>> > Cindy Meister kfengbest - 29 Jan 2007 07:53 GMT Hi Tony,
Thanks for your nice suggestion. If I couldn't find the way to disable Ribbon, FullScreen will be at least the last best choice.
If I run ActiveDocument.ActiveWindow.View.FullScreen = True using VBA, it is working well. But when I tried to automating word in C++.It failed. My code is shown as follow:
MSWORD::_Document oDoc = GetHtmlDocument();//Get the handle from CHtmlView. oDoc.Activate(); MSWORD::Window oActiveWnd = oDoc.GetActiveWindow(); oActiveWnd.Activate(); MSWORD::View oView = oActiveWnd.GetView(); BOOL bFullScreen = oView.GetFullScreen(); //Here get the value bFullScreen = false.
oView.SetFullScreen(TRUE); //Will cause exception!!
oView.SetReadingLayout(TRUE); //Successful to set into Reading Layout mode, but the Ribbon still exist.
Does anybody knows why? Thanks.
>I know nothing of CHtmlView but to maximize the viewing area you could use >.. [quoted text clipped - 43 lines] >>>> > >>>> > Cindy Meister Patrick Schmid [MVP] - 29 Jan 2007 14:05 GMT I posted a solution to one of your other threads about this topic.
Patrick Schmid [OneNote MVP] -------------- http://pschmid.net *** Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80 *** Customize Office 2007: http://pschmid.net/office2007/customize RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer OneNote 2007: http://pschmid.net/office2007/onenote *** Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
> Hi Tony, > [quoted text clipped - 74 lines] > >>>> > > >>>> > Cindy Meister Howard Kaikow - 31 Jan 2007 18:15 GMT You might try the Windows API to hide the ribbon, if we ASSuME that the ribbon is an ordinary window. Otherwise, you might try determining which window is the parent of the Ribbon, and then using the API to mess around.
kfengbest - 01 Feb 2007 09:47 GMT Thank you Howard, It's a good idea. I could hook the handle of ribbon and hide it. But I am unable to minimize the ribbon area by using MoveWindow() of SetWindowPos(). So it remains a white rectangle in ribbon area:(
Here is the code: CFindWnd fwndRibbon(this->GetSafeHwnd(),_T("NetUIHWND")); CWnd *pWndRibbon = CWnd::FromHandle(fwndRibbon.m_hWnd); if( pWndRibbon) { m_pWndRibbon->ShowWindow(SW_HIDE); //Could hide the ribbon. // m_pWndRibbon->MoveWindow(0,0,1,1,TRUE);// I Hope to minimize it into a point, but failed. // m_pWndRibbon->SetWindowPos(NULL,0,0,1,1,SWP_HIDEWINDOW); }
> You might try the Windows API to hide the ribbon, if we ASSuME that the > ribbon is an ordinary window. > Otherwise, you might try determining which window is the parent of the > Ribbon, and then using the API to mess around. Howard Kaikow - 01 Feb 2007 21:15 GMT > Thank you Howard, It's a good idea. I could hook the handle of ribbon and > hide it. > But I am unable to minimize the ribbon area by using MoveWindow() of > SetWindowPos(). > So it remains a white rectangle in ribbon area:( Try using SendMessage. Might work?
kfengbest - 05 Feb 2007 00:48 GMT No, SendMessage/PostMessage does not work:(
>> Thank you Howard, It's a good idea. I could hook the handle of ribbon and >> hide it. [quoted text clipped - 4 lines] > Try using SendMessage. > Might work? Howard Kaikow - 06 Feb 2007 18:25 GMT > No, SendMessage/PostMessage does not work:( Perhaps, the critter is not really a window. You might have to be sneaky as in http://www/standards.com/index.html?SetVBAProjectPassword
Patrick Schmid [MVP] - 27 Jan 2007 00:56 GMT I asked about this: When an Office app is OLE hosted, you can toggle on and off the UI using an OLE command. I don't know which OLE command this is, but it is the one that IE sends when you push the "Tools" button, which toggles the toolbars or ribbon on and off. You should be able to just send that message and hide the Ribbon that way. Sorry, I don't know anything about OLE-hosting, so I can't tell you what the message is, but it should be documented.
Patrick Schmid [OneNote MVP] -------------- http://pschmid.net *** Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80 Office 2007 Beta 2 Technical Refresh (B2TR): http://pschmid.net/blog/2006/09/18/43 *** Customize Office 2007: http://pschmid.net/office2007/customize RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer OneNote 2007: http://pschmid.net/office2007/onenote *** Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
> Hello all, > [quoted text clipped - 6 lines] > > Kaven. kfengbest - 31 Jan 2007 02:42 GMT Hello Patrick,
Thank you for your nice suggestion. I did have searched this possible *message* or *OLE command* from IE that could toggle off the ribbon. But I got nothing and have spent too much time on this issue:(
There is no Ribbon when open a word 2007 file in IE.So the IE must have done some thing internal. Could you help me to ask about this issue from Microsoft's IE team? It is very appricated for your help!
>I asked about this: > When an Office app is OLE hosted, you can toggle on and off the UI using [quoted text clipped - 29 lines] >> >> Kaven. kfengbest - 31 Jan 2007 02:59 GMT And I'd like to give more info about the other possible solutions I have tried. Thanks for the help from Cindy M.
Solution 1 is invoke Window.ToggleRibbon from word's object model. But it is only collapse the Ribbon into an old style menu not hide them all.
Solution 2 is set startFromScratch=TRUE in CustomUI.xml. This also could not hide all the ribbon area completely.The big round button and quick access toolbar area and some other command,such as "help",will remain.
Neither of them are comfortable to our software.
> Hello Patrick, > [quoted text clipped - 41 lines] >>> >>> Kaven. Patrick Schmid [MVP] - 31 Jan 2007 03:22 GMT Sorry, I don't have any contacts in the IE team nor do I think you'd get any far asking this in an IE related group or forum. This is not an IE issue, but an OLE problem. You might want to ask this question in an MS development group or forum, preferably one that handles OLE. I am pretty sure people there will know how to do this. One such group is Microsoft.public.win32.programmer.ole
Patrick Schmid [OneNote MVP] -------------- http://pschmid.net *** Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80 *** Customize Office 2007: http://pschmid.net/office2007/customize RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer OneNote 2007: http://pschmid.net/office2007/onenote *** Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
> Hello Patrick, > [quoted text clipped - 41 lines] > >> > >> Kaven. kfengbest - 31 Jan 2007 05:43 GMT Thank you for your illumination Patrick!
> Sorry, I don't have any contacts in the IE team nor do I think you'd get > any far asking this in an IE related group or forum. This is not an IE [quoted text clipped - 66 lines] >> >> >> >> Kaven.
|
|
|