Solved

Word 2010 Ribbon XML - Add Watermark and Picture Compress options

Posted on 2014-01-23
5
895 Views
Last Modified: 2014-01-28
Hi Super Gurus

I have created special ribbon buttons for my client and the two options that I can't work out how to add to my ribbon is the Watermark option (Page Layout, Watermark) and Picture Compress dialog box.  I have attached three images of what I'm referring to.

I used the Customise Ribbon option and dragged these two options into a new group and they worked fine.  I then used 'Export all customizations' to save those settings into a "Word Customizations.exportedUI" file so that I could see what code was generated.  The code that it constructed for those two options are:

<mso:control idQ="mso:PicturesCompress" />
<mso:gallery idQ="mso:WatermarkGallery" />

I can't work out how to use this in my xml code so that when the user clicks those options they run in the same way as they should in Word.

For example, here is xml code that I have for the watermark command:

<button id="btnWatermarkGallery" label="Show/Hide DRAFT watermark" screentip="Show/Hide DRAFT watermark" onAction="MenuButtonOnAction"  />

How do I incorporate the information <mso:gallery idQ="mso:WatermarkGallery" /> into my existing code?  Do I still need to use OnAction?  I was hoping that Word would know what inbuilt command to run when these options were selected by the user and would not need me to specify anything within the MenuButtonOnAction statement.

Also advice on how to use the PicturesCompress command in the xml code would be really appreciated.  I noticed that one is a control idQ and the other was a gallery idQ so not sure what to do with that information.

Thank you so much ...

HJ
Watermark-button.jpg
Compress-Pictures.jpg
Compress-Pictures-Button.jpg
0
Comment
Question by:hj_daisy
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:Zack Barresse
Comment Utility
Hi there,

Change your id to "PicturesCompress". You can't assign a unique id to a built-in control you're using, and you can't define an onAction for it either. So if you want a button to perform the native functionality your XML should read:
<button idMso="PicturesCompress"/>

Open in new window


But if you wanted your own routine to run from the callback but you wanted that image, you could use the "imageMso" property:
<button id="btnWatermarkGallery" imageMso="PicturesCompress" label="Show/Hide DRAFT watermark" screentip="Show/Hide DRAFT watermark" onAction="MenuButtonOnAction"  />

Open in new window


I don't know how the built-in functionality of these controls works, but there's no way we can optimize it, especially in VBA, since it's compiled in C#, a much faster language than VBA.

HTH

Regards,
Zack Barresse
0
 

Author Comment

by:hj_daisy
Comment Utility
Hi Zack

Thank you so much for your advice.  The PicturesCompress worked perfectly and the dialog box appears on the screen when that option is clicked.

I had trouble with the WatermarkGallery code.  I don't want any macro routine to run from my template but to just show the user the Watermark dropdown panel appear OR have the watermark dialog box display for the user.  My preference is for the watermark dialog box to appear on the screen.

I've attached images of both these situations.

Being a 'gallery' image and not a 'control' image, I'm not sure how to write that in the xml code and I tried a few things but no luck.

Thanks for any advice...

regards
HJ
Watermark-dialog-box.jpg
Watermark-gallery-list.jpg
0
 
LVL 14

Accepted Solution

by:
Zack Barresse earned 500 total points
Comment Utility
Yeah, you'd need to call the idMso of that gallery, so your XML to use the built-in gallery would be this...

<gallery idMso="WatermarkGallery" size="large"/>

Open in new window


You can place this anywhere in your custom ribbon and it'll be the same as the native functionality.

HTH

Zack
0
 

Author Comment

by:hj_daisy
Comment Utility
Works brilliantly.... thank you so much.  It seems so simple, I can't believe I struggled with such a little command.

Thank Zack....


regards
HJ
0
 
LVL 14

Expert Comment

by:Zack Barresse
Comment Utility
Welcome to XML. The simplest and most confusing language conceived - ever. LOL! There's no good IDE for it either, so it's almost always created in a text editor.

Glad to be of help.

Take care,
Zack
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
My experience with Windows 10 over a one year period and suggestions for smooth operation
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now