How to hide the Robbin in word 2007 programmable?

K

kfengbest

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.
 
C

Cindy M.

Replied to duplicate question in one of the office.developer
newsgroups.

Cindy Meister
 
P

Patrick Schmid [MVP]

K

kfengbest

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.


Patrick Schmid said:
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.
 
P

Patrick Schmid [MVP]

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
 
T

Tony Jollans

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.

--
Enjoy,
Tony

kfengbest said:
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.


Patrick Schmid said:
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
 
P

Patrick Schmid [MVP]

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
 
K

kfengbest

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.


Tony Jollans said:
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.

--
Enjoy,
Tony

kfengbest said:
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.


Patrick Schmid said:
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
 
P

Patrick Schmid [MVP]

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,

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.


Tony Jollans said:
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.

--
Enjoy,
Tony

kfengbest said:
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.

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
 
K

kfengbest

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!


Patrick Schmid said:
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,

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.
 
K

kfengbest

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.

kfengbest said:
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!


Patrick Schmid said:
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,

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.
 
P

Patrick Schmid [MVP]

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,

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!


Patrick Schmid said:
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,

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.
 
K

kfengbest

Thank you for your illumination Patrick!

Patrick Schmid said:
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,

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!


Patrick Schmid said:
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,

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.
 
H

Howard Kaikow

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.
 
K

kfengbest

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);
}
 
H

Howard Kaikow

kfengbest said:
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top