Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 972
  • Last Modified:

Word 2010 Ribbon XML - Add Watermark and Picture Compress options

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
hj_daisy
Asked:
hj_daisy
  • 3
  • 2
1 Solution
 
Zack BarresseCEOCommented:
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
 
hj_daisyAuthor Commented:
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
 
Zack BarresseCEOCommented:
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
 
hj_daisyAuthor Commented:
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
 
Zack BarresseCEOCommented:
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now