Solved

Word 2010 Ribbon XML - Add Watermark and Picture Compress options

Posted on 2014-01-23
5
910 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
ID: 39805258
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
ID: 39805378
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
ID: 39805391
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
ID: 39816607
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
ID: 39816610
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

863 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

19 Experts available now in Live!

Get 1:1 Help Now